From 0e08f150112a86a239aca5cd6bdc5ccd162021a0 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 24 Oct 2013 10:27:18 -0400 Subject: [PATCH] Add a last_login field for persons. --- .../versions/4099fa344171_add_last_login.py | 26 +++++++++++++++++++ tahrir_api/model.py | 1 + 2 files changed, 27 insertions(+) create mode 100644 alembic/versions/4099fa344171_add_last_login.py diff --git a/alembic/versions/4099fa344171_add_last_login.py b/alembic/versions/4099fa344171_add_last_login.py new file mode 100644 index 0000000..6b950be --- /dev/null +++ b/alembic/versions/4099fa344171_add_last_login.py @@ -0,0 +1,26 @@ +"""add last login + +Revision ID: 4099fa344171 +Revises: 139ec7ed17b7 +Create Date: 2013-10-24 10:13:45.104902 + +""" + +# revision identifiers, used by Alembic. +revision = '4099fa344171' +down_revision = '139ec7ed17b7' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.add_column('persons', sa.Column('last_login', sa.DateTime(), nullable=True)) + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_column('persons', 'last_login') + ### end Alembic commands ### diff --git a/tahrir_api/model.py b/tahrir_api/model.py index 645bba6..feae3d1 100644 --- a/tahrir_api/model.py +++ b/tahrir_api/model.py @@ -105,6 +105,7 @@ class Person(DeclarativeBase): bio = Column(Unicode(140)) created_on = Column(DateTime, nullable=False, default=datetime.datetime.now) + last_login = Column(DateTime, nullable=True, default=None) opt_out = Column(Boolean, nullable=False, default=False) # An integer that organizes the users by the number of # badges they have ever been awarded. A value of None