max / makenotwork
| 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 | IF EXISTS idx_sync_log_batch_id; |
| 7 | ON sync_log (app_id, user_id, batch_id) WHERE batch_id IS NOT NULL; |
| 8 |