pyfedi/migrations/versions/81175e11c083_report_in_community.py

39 lines
1.3 KiB
Python
Raw Normal View History

"""report in community
Revision ID: 81175e11c083
Revises: e72aa356e4d0
Create Date: 2024-03-18 20:37:43.216482
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '81175e11c083'
down_revision = 'e72aa356e4d0'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('report', schema=None) as batch_op:
batch_op.add_column(sa.Column('in_community_id', sa.Integer(), nullable=True))
batch_op.drop_constraint('report_suspect_community_id_fkey', type_='foreignkey')
batch_op.create_foreign_key(None, 'community', ['suspect_community_id'], ['id'])
batch_op.create_foreign_key(None, 'community', ['in_community_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('report', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.create_foreign_key('report_suspect_community_id_fkey', 'user', ['suspect_community_id'], ['id'])
batch_op.drop_column('in_community_id')
# ### end Alembic commands ###