19 lines
1020 B
SQL
19 lines
1020 B
SQL
-- +goose Up
|
|
-- Besides succeeding or failing, a run can now end parked, waiting for approval
|
|
-- or declined. A failed step or a workflow.finish step parks a run for an
|
|
-- operator to retry from a step; a workflow.finish step can also leave it
|
|
-- waiting for approval or declined. detail explains the ending. Parked and
|
|
-- waiting runs are not terminal.
|
|
ALTER TABLE runs.runs DROP CONSTRAINT runs_state_check;
|
|
ALTER TABLE runs.runs ADD CONSTRAINT runs_state_check
|
|
CHECK (state IN ('queued', 'running', 'waiting', 'succeeded', 'failed', 'cancelled',
|
|
'parked', 'waiting_approval', 'declined'));
|
|
ALTER TABLE runs.runs ADD COLUMN detail text;
|
|
|
|
-- +goose Down
|
|
UPDATE runs.runs SET state = 'failed' WHERE state IN ('parked', 'waiting_approval', 'declined');
|
|
ALTER TABLE runs.runs DROP COLUMN detail;
|
|
ALTER TABLE runs.runs DROP CONSTRAINT runs_state_check;
|
|
ALTER TABLE runs.runs ADD CONSTRAINT runs_state_check
|
|
CHECK (state IN ('queued', 'running', 'waiting', 'succeeded', 'failed', 'cancelled'));
|