-- Migration 013: Add resource event sync watermarks
-- Mirrors the discussions_synced_for_updated_at pattern so that only entities
-- whose updated_at exceeds the last resource event sync get re-enqueued.

ALTER TABLE issues ADD COLUMN resource_events_synced_for_updated_at INTEGER;
ALTER TABLE merge_requests ADD COLUMN resource_events_synced_for_updated_at INTEGER;

-- Update schema version
INSERT INTO schema_version (version, applied_at, description)
VALUES (13, strftime('%s', 'now') * 1000, 'Add resource event sync watermarks to issues and merge_requests');
