- Add SourceType::Note with extract_note_document() and ParentMetadataCache - Migration 022: composite indexes for notes queries + author_id column - Migration 024: table rebuild adding 'note' to CHECK constraints, defense triggers - Migration 025: backfill existing non-system notes into dirty queue - Add lore notes CLI command with 17 filter options (author, path, resolution, etc.) - Support table/json/jsonl/csv output formats with field selection - Wire note dirty tracking through discussion and MR discussion ingestion - Fix test_migration_024_preserves_existing_data off-by-one (tested wrong migration) - Fix upsert_document_inner returning false for label/path-only changes
9 lines
461 B
SQL
9 lines
461 B
SQL
-- Backfill existing non-system notes into dirty queue for document generation.
|
|
-- Only seeds notes that don't already have documents and aren't already queued.
|
|
INSERT INTO dirty_sources (source_type, source_id, queued_at)
|
|
SELECT 'note', n.id, CAST(strftime('%s', 'now') AS INTEGER) * 1000
|
|
FROM notes n
|
|
LEFT JOIN documents d ON d.source_type = 'note' AND d.source_id = n.id
|
|
WHERE n.is_system = 0 AND d.id IS NULL
|
|
ON CONFLICT(source_type, source_id) DO NOTHING;
|