"""One-time migration: add performance indexes for shot table queries."""
from sqlalchemy import text
from database import engine

indexes = [
    "CREATE INDEX IF NOT EXISTS ix_tasks_shot_id ON tasks (shot_id)",
    "CREATE INDEX IF NOT EXISTS ix_tasks_assigned_user_id ON tasks (assigned_user_id)",
    "CREATE INDEX IF NOT EXISTS ix_tasks_deleted_at ON tasks (deleted_at)",
    "CREATE INDEX IF NOT EXISTS ix_episodes_project_id ON episodes (project_id)",
]

with engine.connect() as conn:
    for sql in indexes:
        conn.execute(text(sql))
        print(f"OK: {sql}")
    conn.commit()

print("Done.")
