An approval, ask or park can be resolved by an operator, a rule, a classifier or automatically, so the vocabulary stops naming a person: - step type human.approve -> workflow.approve - park class needs_human -> needs_decision (ParkNeedsDecision) - event kinds human_* -> operator_* - alert kind task.needs_human -> task.needs_decision - status grouping "needs you" -> "needs attention" 0061 rewrites the stored values, including the approval step type in the workflow-definitions resource and each task's pinned definition, with the digest recomputed so resumed tasks still match.
48 lines
2.3 KiB
SQL
48 lines
2.3 KiB
SQL
-- One vocabulary for whatever decides an approval, an ask or a park. A person
|
|
-- was never the only decider, so the stored values stop naming one: the park
|
|
-- class, the approval event kinds, the task alert kind and the approval step
|
|
-- type all move. Stored workflow definitions keep working because the step
|
|
-- type is rewritten in both the resource document and each task's pinned copy.
|
|
|
|
-- +goose Up
|
|
UPDATE tasks SET park_class = 'needs_decision' WHERE park_class = 'needs_human';
|
|
ALTER TABLE tasks ALTER COLUMN park_class SET DEFAULT 'needs_decision';
|
|
|
|
UPDATE events SET kind = 'operator_' || substr(kind, 7)
|
|
WHERE kind IN ('human_approved', 'human_rejected', 'human_rereviewed');
|
|
|
|
UPDATE alerts SET kind = 'task.needs_decision' WHERE kind = 'task.needs_human';
|
|
|
|
UPDATE tasks
|
|
SET workflow_definition_yaml = replace(workflow_definition_yaml, 'human.approve', 'workflow.approve'),
|
|
workflow_definition_digest = CASE
|
|
WHEN workflow_definition_digest = '' THEN ''
|
|
ELSE encode(sha256(convert_to(replace(workflow_definition_yaml, 'human.approve', 'workflow.approve'), 'UTF8')), 'hex')
|
|
END
|
|
WHERE workflow_definition_yaml LIKE '%human.approve%';
|
|
|
|
UPDATE resources
|
|
SET value = convert_to(replace(convert_from(value, 'UTF8'), 'human.approve', 'workflow.approve'), 'UTF8')
|
|
WHERE kind = 'workflow-definitions' AND convert_from(value, 'UTF8') LIKE '%human.approve%';
|
|
|
|
-- +goose Down
|
|
UPDATE tasks SET park_class = 'needs_human' WHERE park_class = 'needs_decision';
|
|
ALTER TABLE tasks ALTER COLUMN park_class SET DEFAULT 'needs_human';
|
|
|
|
UPDATE events SET kind = 'human_' || substr(kind, 10)
|
|
WHERE kind IN ('operator_approved', 'operator_rejected', 'operator_rereviewed');
|
|
|
|
UPDATE alerts SET kind = 'task.needs_human' WHERE kind = 'task.needs_decision';
|
|
|
|
UPDATE tasks
|
|
SET workflow_definition_yaml = replace(workflow_definition_yaml, 'workflow.approve', 'human.approve'),
|
|
workflow_definition_digest = CASE
|
|
WHEN workflow_definition_digest = '' THEN ''
|
|
ELSE encode(sha256(convert_to(replace(workflow_definition_yaml, 'workflow.approve', 'human.approve'), 'UTF8')), 'hex')
|
|
END
|
|
WHERE workflow_definition_yaml LIKE '%workflow.approve%';
|
|
|
|
UPDATE resources
|
|
SET value = convert_to(replace(convert_from(value, 'UTF8'), 'workflow.approve', 'human.approve'), 'UTF8')
|
|
WHERE kind = 'workflow-definitions' AND convert_from(value, 'UTF8') LIKE '%workflow.approve%';
|