"""add_technique_query_indexes Add indexes on techniques table for common query patterns (filter by tactic, filter by status_global) used in heatmap, scoring, and list-all-techniques operations. These may already exist if the ORM model auto-created them; the ``if_not_exists`` flag makes this migration safe to run regardless. Revision ID: b026techidx Revises: b025uqtdr Create Date: 2026-02-18 18:00:00.000000 """ from typing import Sequence, Union from alembic import op revision: str = "b026techidx" down_revision: Union[str, None] = "b025uqtdr" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None def upgrade() -> None: op.execute( "CREATE INDEX IF NOT EXISTS ix_techniques_tactic " "ON techniques (tactic)" ) op.execute( "CREATE INDEX IF NOT EXISTS ix_techniques_status_global " "ON techniques (status_global)" ) def downgrade() -> None: op.drop_index("ix_techniques_status_global", table_name="techniques") op.drop_index("ix_techniques_tactic", table_name="techniques")