Skip to main content

max / makenotwork

403 B · 8 lines History Blame Raw
1 -- Fix: batch_id unique index was too restrictive — a single push batch
2 -- inserts multiple sync_log rows (one per change), all sharing the same
3 -- batch_id. Replace the unique index with a regular index used only by
4 -- the idempotency MAX(seq) query.
5
6 DROP INDEX IF EXISTS idx_sync_log_batch_id;
7 CREATE INDEX idx_sync_log_batch_id ON sync_log (app_id, user_id, batch_id) WHERE batch_id IS NOT NULL;
8