"""community instance

Revision ID: 5fb8f21295da
Revises: 31dfc1d1d3f6
Create Date: 2023-12-13 20:57:09.647260

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '5fb8f21295da'
down_revision = '31dfc1d1d3f6'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('community', 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_community_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('community', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_index(batch_op.f('ix_community_instance_id'))
        batch_op.drop_column('instance_id')

    # ### end Alembic commands ###