Persist typed RunManifest bytes and SHA per run, and allow a finalizing status so U8 can freeze a unique terminal without sharing env databases. Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.6 KiB
SQL
55 lines
1.6 KiB
SQL
-- +goose Up
|
|
-- U8: typed RunManifest persistence and optional finalizing status.
|
|
|
|
ALTER TABLE task_runs DROP CONSTRAINT IF EXISTS chk_task_run_status;
|
|
|
|
ALTER TABLE task_runs ADD CONSTRAINT chk_task_run_status CHECK (
|
|
status IN (
|
|
'pending',
|
|
'running',
|
|
'finalizing',
|
|
'completed',
|
|
'failed',
|
|
'cancelled',
|
|
'finalizing_failed',
|
|
'quality_failed',
|
|
'interrupted',
|
|
'pending_author_confirmation',
|
|
'blocked_pending_governance'
|
|
)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS task_run_manifests (
|
|
run_id TEXT PRIMARY KEY REFERENCES task_runs(run_id) ON DELETE CASCADE,
|
|
canonical_bytes BYTEA NOT NULL,
|
|
sha256 CHAR(64) NOT NULL,
|
|
workspace_id TEXT NOT NULL DEFAULT '',
|
|
storage_identity TEXT NOT NULL DEFAULT '',
|
|
members JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
CONSTRAINT uq_task_run_manifests_run UNIQUE (run_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_task_run_manifests_sha ON task_run_manifests (sha256);
|
|
|
|
-- +goose Down
|
|
DROP INDEX IF EXISTS idx_task_run_manifests_sha;
|
|
DROP TABLE IF EXISTS task_run_manifests;
|
|
|
|
ALTER TABLE task_runs DROP CONSTRAINT IF EXISTS chk_task_run_status;
|
|
|
|
ALTER TABLE task_runs ADD CONSTRAINT chk_task_run_status CHECK (
|
|
status IN (
|
|
'pending',
|
|
'running',
|
|
'completed',
|
|
'failed',
|
|
'cancelled',
|
|
'finalizing_failed',
|
|
'quality_failed',
|
|
'interrupted',
|
|
'pending_author_confirmation',
|
|
'blocked_pending_governance'
|
|
)
|
|
);
|