-- Step executions: one durable record per stage run and per agent or -- workflow.call step inside a WorkflowExecution -- (docs/prds/execution-tree-state-machine.md). Statuses are taskstate's -- StepStatus vocabulary and move only through the step transition table the -- store enforces; depth is derived from parent_id, never supplied by a -- caller. Existing rows gain no backfilled steps: their stage history stays -- in transitions and events. -- +goose Up CREATE TABLE step_executions ( id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, org_id text NOT NULL DEFAULT 'default', workspace_id text NOT NULL DEFAULT 'default', execution_id bigint NOT NULL, attempt bigint NOT NULL, parent_id bigint, depth int NOT NULL DEFAULT 0, kind text NOT NULL, name text NOT NULL, called_execution_id bigint NOT NULL DEFAULT 0, status text NOT NULL DEFAULT 'pending', detail text NOT NULL DEFAULT '', tokens_used bigint NOT NULL DEFAULT 0, started_at timestamptz, finished_at timestamptz ); CREATE INDEX idx_step_executions_attempt ON step_executions (execution_id, attempt, id); -- +goose Down DROP TABLE step_executions;