Persist exact workflow revisions additively

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
This commit is contained in:
Logan Johnson
2026-08-27 17:07:36 -04:00
committed by Larry
parent be8d7756d5
commit ca2c16cfd9
8 changed files with 182 additions and 35 deletions

View File

@@ -368,6 +368,9 @@ CREATE TABLE workflows (
channel_id UUID,
definition JSONB NOT NULL,
definition_hash BYTEA NOT NULL,
definition_event_id BYTEA CHECK (
definition_event_id IS NULL OR octet_length(definition_event_id) = 32
),
status workflow_status NOT NULL DEFAULT 'active',
enabled BOOLEAN NOT NULL DEFAULT TRUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
@@ -388,6 +391,9 @@ CREATE TABLE workflow_runs (
community_id UUID NOT NULL REFERENCES communities(id),
id UUID NOT NULL DEFAULT gen_random_uuid(),
workflow_id UUID NOT NULL,
definition_event_id BYTEA CHECK (
definition_event_id IS NULL OR octet_length(definition_event_id) = 32
),
status run_status NOT NULL DEFAULT 'pending',
trigger_event_id BYTEA,
current_step INT NOT NULL DEFAULT 0,