"""community image

Revision ID: feef49234599
Revises: 93e4cef1698c
Create Date: 2023-08-27 19:04:44.591324

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'feef49234599'
down_revision = '93e4cef1698c'
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('image_id', sa.Integer(), nullable=True))
        batch_op.create_foreign_key(None, 'file', ['image_id'], ['id'])

    with op.batch_alter_table('instance', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_instance_domain'), ['domain'], unique=False)

    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_user_verification_token'), ['verification_token'], unique=False)

    # ### 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_index(batch_op.f('ix_user_verification_token'))

    with op.batch_alter_table('instance', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_instance_domain'))

    with op.batch_alter_table('community', schema=None) as batch_op:
        batch_op.drop_constraint(None, type_='foreignkey')
        batch_op.drop_column('image_id')

    # ### end Alembic commands ###