Files
Agent-System/deploy/postgres/goose/00037_2026-09-15-task-run-manifests.sql
T
weichenandCursor eb75f855a5 feat(db): add goose 00037 task_run_manifests
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>
2026-09-15 02:05:33 +00:00

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'
)
);