Files
LinkDesk/backend/add_perf_indexes.py
indigo 0acf9ddff2 Optimize shot table loading performance
- Pass episode_id filter to backend API instead of client-side filtering,
  reducing payload size when an episode is selected
- Skip getShot refetch in ShotDetailPanel when initialShot prop is provided
- Fix redundant DB query in list_shots: read project.custom_task_statuses
  directly from the already-fetched project object
- Add missing indexes on Task.shot_id, Task.assigned_user_id,
  Task.deleted_at and Episode.project_id; add add_perf_indexes.py
  migration script to apply them to existing databases
- Center login page layout
- Update CLAUDE.md and AGENTS.md with correct venv path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 00:30:18 +08:00

19 lines
611 B
Python

"""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.")