max / makenotwork
| 1 | -- Idempotency key for internally-created replies, mirroring threads.external_ref |
| 2 | -- (m021). The internal `POST /internal/threads/{id}/posts` path is server→server |
| 3 | -- and retry-prone (network blip, MNW-side retry, or a replayed request); without |
| 4 | -- a dedup key a retry inserts a duplicate reply. The unique index makes a repeat |
| 5 | -- insert with the same ref a no-op (ON CONFLICT DO NOTHING in the mutation), |
| 6 | -- matching the thread path. Partial so user-facing replies (external_ref NULL) |
| 7 | -- are unconstrained. |
| 8 | posts ADD COLUMN external_ref TEXT; |
| 9 | ON posts (external_ref) WHERE external_ref IS NOT NULL; |
| 10 |