"""add_performance_indexes

Revision ID: ccd68dc784ff
Revises: 20250618140000
Create Date: 2025-07-15 11:48:42.854741

"""

from typing import Sequence, Union

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "ccd68dc784ff"
down_revision: Union[str, None] = "20250618140000"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("meeting", schema=None) as batch_op:
        batch_op.create_index("idx_meeting_room_id", ["room_id"], unique=False)

    with op.batch_alter_table("recording", schema=None) as batch_op:
        batch_op.create_index("idx_recording_meeting_id", ["meeting_id"], unique=False)

    with op.batch_alter_table("room", schema=None) as batch_op:
        batch_op.create_index("idx_room_is_shared", ["is_shared"], unique=False)

    with op.batch_alter_table("transcript", schema=None) as batch_op:
        batch_op.create_index("idx_transcript_created_at", ["created_at"], unique=False)
        batch_op.create_index(
            "idx_transcript_recording_id", ["recording_id"], unique=False
        )
        batch_op.create_index("idx_transcript_user_id", ["user_id"], unique=False)

    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("transcript", schema=None) as batch_op:
        batch_op.drop_index("idx_transcript_user_id")
        batch_op.drop_index("idx_transcript_recording_id")
        batch_op.drop_index("idx_transcript_created_at")

    with op.batch_alter_table("room", schema=None) as batch_op:
        batch_op.drop_index("idx_room_is_shared")

    with op.batch_alter_table("recording", schema=None) as batch_op:
        batch_op.drop_index("idx_recording_meeting_id")

    with op.batch_alter_table("meeting", schema=None) as batch_op:
        batch_op.drop_index("idx_meeting_room_id")

    # ### end Alembic commands ###
