FitTrackee/fittrackee/migrations/versions/11_27425324c9e3_add _weekm_user_table.py

29 lines
684 B
Python

"""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 ###