-- +goose Up -- A workflow.call step starts a child run. parent_run_id and parent_signal say -- which run, and which signal key, to wake when the child ends; call_depth -- bounds how deep calls nest. A run started by a handoff has no parent. ALTER TABLE runs.runs ADD COLUMN parent_run_id uuid REFERENCES runs.runs (id) ON DELETE CASCADE; ALTER TABLE runs.runs ADD COLUMN parent_signal text; ALTER TABLE runs.runs ADD COLUMN call_depth integer NOT NULL DEFAULT 0; CREATE INDEX runs_runs_parent ON runs.runs (parent_run_id) WHERE parent_run_id IS NOT NULL; -- +goose Down DROP INDEX runs.runs_runs_parent; ALTER TABLE runs.runs DROP COLUMN call_depth; ALTER TABLE runs.runs DROP COLUMN parent_signal; ALTER TABLE runs.runs DROP COLUMN parent_run_id;