Files
gitlore/migrations/015_commit_shas_and_closes_watermark.sql
Taylor Eernisse 233eb546af feat: Add commit SHAs, closes_issues watermark, and PRD alignment
Migration 015 adds merge_commit_sha/squash_commit_sha to merge_requests
(Gate 4/5 prerequisites), closes_issues_synced_for_updated_at watermark
for incremental sync, and the missing idx_label_events_label index.

The MR transformer and ingestion pipeline now populate commit SHAs during
sync. The orchestrator uses watermark-based filtering for closes_issues
jobs instead of re-enqueuing all MRs every sync.

The Phase B PRD is updated to match the actual codebase: corrected
migration numbering (011-015), documented nullable label/milestone
fields (migration 012), watermark patterns (013), observability
infrastructure (014), simplified source_method values, and updated
entity_references schema to match implementation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 15:29:51 -05:00

18 lines
997 B
SQL

-- Migration 015: Add commit SHAs to merge_requests, closes_issues watermark,
-- and missing label_name index on resource_label_events.
-- Commit SHAs link MRs to actual git history (needed for Gate 4: file-history, Gate 5: trace)
ALTER TABLE merge_requests ADD COLUMN merge_commit_sha TEXT;
ALTER TABLE merge_requests ADD COLUMN squash_commit_sha TEXT;
-- Watermark for closes_issues sync (same pattern as resource_events_synced_for_updated_at)
-- Prevents re-fetching closes_issues for MRs that haven't changed since last sync
ALTER TABLE merge_requests ADD COLUMN closes_issues_synced_for_updated_at INTEGER;
-- Missing index from original spec: enables efficient label-name filtering in timeline queries
CREATE INDEX IF NOT EXISTS idx_label_events_label ON resource_label_events(label_name);
-- Update schema version
INSERT INTO schema_version (version, applied_at, description)
VALUES (15, strftime('%s', 'now') * 1000, 'Add commit SHAs, closes_issues watermark, and label event index');