Context
PRD v0.2 AC-F3.5 and PR-2 require deduplication via unique delivery_id on webhook_events.
Problem
migrations/001_init.sql stores delivery_id but has no UNIQUE constraint. Issue #9 covers application logic; schema must enforce at DB level.
Proposed scope
- Add migration
002_webhook_delivery_id_unique.sql with partial unique index on delivery_id WHERE delivery_id IS NOT NULL
- Handle conflict in gateway insert path
Acceptance criteria
References
migrations/001_init.sql
crates/gateway/src/attestation.rs (persist_webhook_event)
docs/PRD.md (AC-F3.5, PR-2)
Context
PRD v0.2 AC-F3.5 and PR-2 require deduplication via unique
delivery_idonwebhook_events.Problem
migrations/001_init.sqlstoresdelivery_idbut has no UNIQUE constraint. Issue #9 covers application logic; schema must enforce at DB level.Proposed scope
002_webhook_delivery_id_unique.sqlwith partial unique index ondelivery_id WHERE delivery_id IS NOT NULLAcceptance criteria
X-GitHub-Deliverycannot insert second rowReferences
migrations/001_init.sqlcrates/gateway/src/attestation.rs(persist_webhook_event)docs/PRD.md(AC-F3.5, PR-2)