Generate database migration script

This commit is contained in:
doge 2018-08-11 13:34:58 +00:00 committed by Nicolas F
parent 3190394eea
commit 92ca3a577f
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
"""Add user preferences table
Revision ID: 0b03879cdb05
Revises: f703f911d4ae
Create Date: 2018-08-11 13:23:01.863441
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0b03879cdb05'
down_revision = 'f703f911d4ae'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user_preferences',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('hide_comments', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('user_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('user_preferences')
# ### end Alembic commands ###