FitTrackee/fittrackee/migrations/versions/20_07188ca7620a_add_imperial_units_preferences.py

32 lines
726 B
Python

"""add imperial units preferences
Revision ID: 07188ca7620a
Revises: 080acc8ee956
Create Date: 2021-11-13 19:11:17.753567
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '07188ca7620a'
down_revision = '080acc8ee956'
branch_labels = None
depends_on = None
def upgrade():
op.add_column(
'users',
sa.Column('imperial_units', sa.Boolean(), nullable=True),
)
op.execute("UPDATE users SET imperial_units = false")
op.alter_column('users', 'imperial_units', nullable=False)
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'imperial_units')
# ### end Alembic commands ###