"""add indexes for better performance

Revision ID: 68bae7fcd569
Revises: 6f4088b109fc
Create Date: 2026-01-15 23:33:33.926956

"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils


# revision identifiers, used by Alembic.
revision = '68bae7fcd569'
down_revision = '6f4088b109fc'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('entity', schema=None) as batch_op:
        batch_op.create_index('ix_entity_project_type_status', ['project_id', 'entity_type_id', 'status'], unique=False)
        batch_op.create_index(batch_op.f('ix_entity_status'), ['status'], unique=False)

    with op.batch_alter_table('project_asset_type_link', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_project_asset_type_link_asset_type_id'), ['asset_type_id'], unique=False)
        batch_op.create_index(batch_op.f('ix_project_asset_type_link_project_id'), ['project_id'], unique=False)

    with op.batch_alter_table('project_preview_background_file_link', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_project_preview_background_file_link_preview_background_file_id'), ['preview_background_file_id'], unique=False)
        batch_op.create_index(batch_op.f('ix_project_preview_background_file_link_project_id'), ['project_id'], unique=False)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('project_preview_background_file_link', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_project_preview_background_file_link_project_id'))
        batch_op.drop_index(batch_op.f('ix_project_preview_background_file_link_preview_background_file_id'))

    with op.batch_alter_table('project_asset_type_link', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_project_asset_type_link_project_id'))
        batch_op.drop_index(batch_op.f('ix_project_asset_type_link_asset_type_id'))

    with op.batch_alter_table('entity', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_entity_status'))
        batch_op.drop_index('ix_entity_project_type_status')

    # ### end Alembic commands ###
