API - update user model to store first day of week - #23

This commit is contained in:
Sam
2019-08-31 16:33:46 +02:00
parent 8716bb05a1
commit b00b48e138
9 changed files with 115 additions and 10 deletions

View File

@ -0,0 +1,28 @@
"""add weekm in 'User' table
Revision ID: 27425324c9e3
Revises: 096dd0b43beb
Create Date: 2019-08-31 15:25:09.412426
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '27425324c9e3'
down_revision = '096dd0b43beb'
branch_labels = None
depends_on = None
def upgrade():
op.add_column('users', sa.Column('weekm', sa.Boolean(create_constraint=50), nullable=True))
op.execute("UPDATE users SET weekm = false")
op.alter_column('users', 'weekm', nullable=False)
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'weekm')
# ### end Alembic commands ###