-- The API replaces expired idempotency records under a transaction-scoped lock. GRANT DELETE ON idempotency_keys TO messenger_api; -- The outbox path and worker append records using the audit table's sequence. GRANT USAGE ON SEQUENCE pipeline_audit_id_seq TO messenger_api, messenger_worker;