feat(infra): add repository implementations, mappers, FastAPI wiring, and technique indexes
This commit is contained in:
38
backend/alembic/versions/b026_add_technique_query_indexes.py
Normal file
38
backend/alembic/versions/b026_add_technique_query_indexes.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""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")
|
||||
Reference in New Issue
Block a user