Tier 0 (Ingestion): - NOTE-0A: Upsert/sweep for issue discussion notes (stable IDs) - NOTE-0B: Immediate deletion propagation for swept notes - NOTE-0C: Sweep safety guard for partial fetch protection - NOTE-0D: Capture immutable author_id in note upserts Tier 1 (Query/CLI): - NOTE-1A: Note query layer data types and filters (28+ filter combinations) - NOTE-1B: CLI arguments and command wiring for lore notes - NOTE-1C: Human and robot output formatting (table/json/jsonl/csv) - NOTE-1D: robot-docs integration for notes command - NOTE-1E: Migration 022 — composite query indexes + author_id column Tier 2 (Document/Search): - NOTE-2A: Migration 024 — schema rebuild for note documents - NOTE-2B: SourceType::Note enum extension - NOTE-2C: Note document extractor function - NOTE-2D: Regenerator and dirty tracking for note documents - NOTE-2E: Generate-docs full rebuild support for notes - NOTE-2F: Search CLI --type note support - NOTE-2G: Parent metadata change propagation to note documents - NOTE-2H: Migration 025 — backfill existing notes after upgrade - NOTE-2I: Batch parent metadata cache for note regeneration 21 files changed, 5364 insertions, 713 tests passing.
22 lines
1016 B
SQL
22 lines
1016 B
SQL
-- Migration 022: Composite query indexes for notes + author_id column
|
|
-- Optimizes author-scoped and project-scoped date-range queries on notes.
|
|
-- Adds discussion JOIN indexes and immutable author identity column.
|
|
|
|
-- Composite index for author-scoped queries (who command, notes --author)
|
|
CREATE INDEX IF NOT EXISTS idx_notes_user_created
|
|
ON notes(project_id, author_username COLLATE NOCASE, created_at DESC, id DESC)
|
|
WHERE is_system = 0;
|
|
|
|
-- Composite index for project-scoped date-range queries
|
|
CREATE INDEX IF NOT EXISTS idx_notes_project_created
|
|
ON notes(project_id, created_at DESC, id DESC)
|
|
WHERE is_system = 0;
|
|
|
|
-- Discussion JOIN indexes
|
|
CREATE INDEX IF NOT EXISTS idx_discussions_issue_id ON discussions(issue_id);
|
|
CREATE INDEX IF NOT EXISTS idx_discussions_mr_id ON discussions(merge_request_id);
|
|
|
|
-- Immutable author identity column (GitLab numeric user ID)
|
|
ALTER TABLE notes ADD COLUMN author_id INTEGER;
|
|
CREATE INDEX IF NOT EXISTS idx_notes_author_id ON notes(author_id) WHERE author_id IS NOT NULL;
|