- store trigger dispatches as started or skipped, with a JSON reason surfaced in the API and UI - persist the answering account's identity id beside its display name for approvals and judgements - save connector acceptances and their declarations in one transaction so a refused change stores nothing
18 lines
755 B
SQL
18 lines
755 B
SQL
-- +goose Up
|
|
-- A dispatch records the outcome of a trigger for an event: a started run or a
|
|
-- skip. A skip's reason is a JSON document with a code and display details,
|
|
-- such as the mapping fields that failed.
|
|
ALTER TABLE events.dispatches
|
|
ALTER COLUMN run_id DROP NOT NULL,
|
|
ADD COLUMN outcome text NOT NULL DEFAULT 'started' CHECK (outcome IN ('started', 'skipped')),
|
|
ADD COLUMN reason jsonb,
|
|
ADD CONSTRAINT dispatches_run_matches_outcome CHECK ((outcome = 'started') = (run_id IS NOT NULL));
|
|
|
|
-- +goose Down
|
|
DELETE FROM events.dispatches WHERE outcome = 'skipped';
|
|
ALTER TABLE events.dispatches
|
|
DROP CONSTRAINT dispatches_run_matches_outcome,
|
|
DROP COLUMN reason,
|
|
DROP COLUMN outcome,
|
|
ALTER COLUMN run_id SET NOT NULL;
|