mirror of
https://github.com/block/buzz.git
synced 2026-10-30 14:01:37 +00:00
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Signed-off-by: Logan Johnson <loganj@squareup.com>
21 lines
927 B
SQL
21 lines
927 B
SQL
-- Durable, payload-free authority for webhook-triggered workflow runs.
|
|
-- The body and secret stay in transient trigger context; this table retains
|
|
-- only an opaque invocation identity and its tenant/workflow/run binding.
|
|
CREATE TABLE workflow_webhook_invocations (
|
|
community_id UUID NOT NULL REFERENCES communities(id),
|
|
invocation_id UUID NOT NULL,
|
|
workflow_id UUID NOT NULL,
|
|
workflow_run_id UUID,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
PRIMARY KEY (community_id, invocation_id),
|
|
FOREIGN KEY (community_id, workflow_id)
|
|
REFERENCES workflows (community_id, id) ON DELETE CASCADE,
|
|
FOREIGN KEY (community_id, workflow_run_id)
|
|
REFERENCES workflow_runs (community_id, id) ON DELETE NO ACTION
|
|
);
|
|
|
|
CREATE INDEX idx_workflow_webhook_invocations_created_at
|
|
ON workflow_webhook_invocations (created_at);
|
|
|
|
SELECT attach_community_write_fence('workflow_webhook_invocations');
|