pyfedi/migrations/versions/e8113bc01e3a_post_reply_instance.py

37 lines
1.1 KiB
Python
Raw Normal View History

2023-12-28 20:00:07 +13:00
"""post reply instance
Revision ID: e8113bc01e3a
Revises: 52789c4b1d0f
Create Date: 2023-12-28 13:11:04.462308
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e8113bc01e3a'
down_revision = '52789c4b1d0f'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('post_reply', schema=None) as batch_op:
batch_op.add_column(sa.Column('instance_id', sa.Integer(), nullable=True))
batch_op.create_index(batch_op.f('ix_post_reply_instance_id'), ['instance_id'], unique=False)
batch_op.create_foreign_key(None, 'instance', ['instance_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('post_reply', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_index(batch_op.f('ix_post_reply_instance_id'))
batch_op.drop_column('instance_id')
# ### end Alembic commands ###