pyfedi/migrations/versions/882e33231c5b_user_roles_additional.py

39 lines
1.1 KiB
Python
Raw Permalink Normal View History

2023-10-18 02:23:59 -07:00
"""user roles additional
Revision ID: 882e33231c5b
Revises: f1f0c854ae18
Create Date: 2023-10-18 22:10:16.602027
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '882e33231c5b'
down_revision = 'f1f0c854ae18'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('role_permission', schema=None) as batch_op:
batch_op.create_foreign_key(None, 'role', ['role_id'], ['id'])
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_column('role')
# ### 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.add_column(sa.Column('role', sa.INTEGER(), autoincrement=False, nullable=True))
with op.batch_alter_table('role_permission', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
# ### end Alembic commands ###