pyfedi/migrations/versions/e73996747d7e_user_language.py

37 lines
1.1 KiB
Python
Raw Normal View History

2024-05-08 18:59:52 -07:00
"""user language
Revision ID: e73996747d7e
Revises: 94828ddc7c63
Create Date: 2024-05-09 13:37:17.010724
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e73996747d7e'
down_revision = '94828ddc7c63'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.add_column(sa.Column('interface_language', sa.String(length=10), nullable=True))
batch_op.add_column(sa.Column('language_id', sa.Integer(), nullable=True))
batch_op.create_foreign_key(None, 'language', ['language_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('language_id')
batch_op.drop_column('interface_language')
# ### end Alembic commands ###