mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 17:15:19 -07:00
Queries throughout the codebase filter on generations.profile_id, generations.status, generations.created_at, story_items.story_id, story_items.generation_id, generation_versions.generation_id, and profile_samples.profile_id with every request. Without indexes SQLite falls back to a full table scan; as history grows (hundreds or thousands of generations) these scans become the dominant latency. Changes: - Add index=True on the most-queried FK and sort columns in models.py so new installs get them from Base.metadata.create_all - Add _migrate_add_indexes() called from run_migrations() so existing installs get the same indexes on next startup (uses CREATE INDEX IF NOT EXISTS — idempotent, <10 ms on any realistic dataset)