From fd62748af6a6a86e5352830abee34975fd935b75 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 23 May 2018 20:18:40 +0100 Subject: [PATCH] Add package creation date Fixes #32 --- app/models.py | 1 + migrations/versions/13113e5710da_.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 migrations/versions/13113e5710da_.py diff --git a/app/models.py b/app/models.py index ec9de981..dad0a03c 100644 --- a/app/models.py +++ b/app/models.py @@ -250,6 +250,7 @@ class Package(db.Model): shortDesc = db.Column(db.String(200), nullable=False) desc = db.Column(db.Text, nullable=True) type = db.Column(db.Enum(PackageType)) + created_at = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) license_id = db.Column(db.Integer, db.ForeignKey("license.id")) diff --git a/migrations/versions/13113e5710da_.py b/migrations/versions/13113e5710da_.py new file mode 100644 index 00000000..5c409277 --- /dev/null +++ b/migrations/versions/13113e5710da_.py @@ -0,0 +1,28 @@ +"""empty message + +Revision ID: 13113e5710da +Revises: ead35f7d446c +Create Date: 2018-05-23 20:18:07.606646 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '13113e5710da' +down_revision = 'ead35f7d446c' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('package', sa.Column('created_at', sa.DateTime(), nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('package', 'created_at') + # ### end Alembic commands ###