diff --git a/deploy/postgres/goose/00042_2026-09-15-workflow-advance-outcome.sql b/deploy/postgres/goose/00042_2026-09-15-workflow-advance-outcome.sql new file mode 100644 index 00000000..2e40546d --- /dev/null +++ b/deploy/postgres/goose/00042_2026-09-15-workflow-advance-outcome.sql @@ -0,0 +1,12 @@ +-- +goose Up +-- E1B: correlate stage-ready unique outcome to envelope event_id. +ALTER TABLE stage_advance_requests + ADD COLUMN IF NOT EXISTS source_event_id TEXT NOT NULL DEFAULT ''; + +CREATE UNIQUE INDEX IF NOT EXISTS uq_sar_source_event + ON stage_advance_requests (source_event_id) + WHERE source_event_id <> ''; + +-- +goose Down +DROP INDEX IF EXISTS uq_sar_source_event; +ALTER TABLE stage_advance_requests DROP COLUMN IF EXISTS source_event_id;