max / makenotwork
| 1 | -- Push idempotency: prevent duplicate entries from client retries. |
| 2 | -- batch_id is a client-generated UUID per push batch. |
| 3 | -- The unique constraint on (app_id, user_id, batch_id) ensures at-most-once semantics. |
| 4 | |
| 5 | sync_log ADD COLUMN batch_id UUID; |
| 6 | |
| 7 | -- Unique constraint for dedup. NULL batch_id (old clients) is ignored by unique constraints. |
| 8 | ON sync_log (app_id, user_id, batch_id) WHERE batch_id IS NOT NULL; |
| 9 |