"""perf: add missing status and composite indexes

Revision ID: t7o8p9q0r1s2
Revises: s6n7o8p9q0r1
Create Date: 2026-05-15

"""
from alembic import op

revision = "t7o8p9q0r1s2"
down_revision = "s6n7o8p9q0r1"
branch_labels = None
depends_on = None


def upgrade() -> None:
    op.create_index("ix_tasks_status", "tasks", ["status"])
    op.create_index("ix_tasks_workstream_status", "tasks", ["workstream_id", "status"])
    op.create_index("ix_workstreams_status", "workstreams", ["status"])
    op.create_index("ix_sbom_snapshots_repo_at", "sbom_snapshots", ["repo_id", "snapshot_at"])


def downgrade() -> None:
    op.drop_index("ix_sbom_snapshots_repo_at", table_name="sbom_snapshots")
    op.drop_index("ix_workstreams_status", table_name="workstreams")
    op.drop_index("ix_tasks_workstream_status", table_name="tasks")
    op.drop_index("ix_tasks_status", table_name="tasks")
