diff --git a/data/database.py b/data/database.py index 4e767c9b0..27bbfb7f8 100644 --- a/data/database.py +++ b/data/database.py @@ -441,6 +441,8 @@ class User(BaseModel): maximum_queued_builds_count = IntegerField(null=True) + creation_date = DateTimeField(default=datetime.utcnow, null=True) + def delete_instance(self, recursive=False, delete_nullable=False): # If we are deleting a robot account, only execute the subset of queries necessary. if self.robot: diff --git a/data/migrations/versions/0cf50323c78b_add_creation_date_to_user_table.py b/data/migrations/versions/0cf50323c78b_add_creation_date_to_user_table.py new file mode 100644 index 000000000..775c5caa7 --- /dev/null +++ b/data/migrations/versions/0cf50323c78b_add_creation_date_to_user_table.py @@ -0,0 +1,26 @@ +"""Add creation date to User table + +Revision ID: 0cf50323c78b +Revises: 87fbbc224f10 +Create Date: 2018-03-09 13:19:41.903196 + +""" + +# revision identifiers, used by Alembic. +revision = '0cf50323c78b' +down_revision = '87fbbc224f10' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(tables): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('user', sa.Column('creation_date', sa.DateTime(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(tables): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('user', 'creation_date') + # ### end Alembic commands ###