Files
notifications-api/migrations/versions/0045_template_stats_update_timestamp.py
Adam Shimali 3057641e40 Change sort order for templates from name to date using full timestamp
so that it would be most recently used at top.
2016-04-06 14:30:13 +01:00

33 lines
981 B
Python

"""empty message
Revision ID: 0045_template_stats_update_time
Revises: 0044_add_template_stats
Create Date: 2016-04-05 14:32:45.165755
"""
# revision identifiers, used by Alembic.
revision = '0045_template_stats_update_time'
down_revision = '0044_add_template_stats'
import datetime
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('template_statistics', sa.Column('updated_at', sa.DateTime(), nullable=True))
updated_at = table('template_statistics', column('updated_at'))
op.execute(updated_at.update().values(updated_at=datetime.datetime.utcnow()))
op.alter_column('template_statistics', 'updated_at', nullable=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('template_statistics', 'updated_at')
### end Alembic commands ###