Files
gitlore/migrations/019_list_performance.sql
Taylor Eernisse 7dd86d5433 fix(db): add missing schema_version insert to migration 019
Migration 019 created performance indexes but never recorded itself
in the schema_version table. Without this row the migration runner
considers the schema outdated and would attempt to re-apply. Adds
the standard INSERT INTO schema_version for version 19.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:33:13 -05:00

17 lines
752 B
SQL

-- Standalone updated_at DESC indexes for ORDER BY without temp B-tree sort.
-- The existing composite indexes (project_id, updated_at) only help when
-- filtering by project first.
CREATE INDEX IF NOT EXISTS idx_issues_updated_at_desc
ON issues(updated_at DESC);
CREATE INDEX IF NOT EXISTS idx_mrs_updated_at_desc
ON merge_requests(updated_at DESC);
-- Covering index for correlated subquery: unresolved discussion count per issue.
-- MRs already have idx_discussions_mr_resolved (migration 006).
CREATE INDEX IF NOT EXISTS idx_discussions_issue_resolved
ON discussions(issue_id, resolvable, resolved);
INSERT INTO schema_version (version, applied_at, description)
VALUES (19, strftime('%s', 'now') * 1000, 'List performance indexes');