Files

18 lines
736 B
SQL

CREATE TABLE prompts (
id text PRIMARY KEY,
repository_id text NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
task_id text NOT NULL DEFAULT '',
attempt_id text NOT NULL DEFAULT '',
state_id text NOT NULL DEFAULT '',
prompt text NOT NULL,
agent_name text NOT NULL DEFAULT '',
agent_model text NOT NULL DEFAULT '',
status text NOT NULL DEFAULT 'running' CHECK (status IN ('running', 'completed', 'failed', 'cancelled')),
response_summary text NOT NULL DEFAULT '',
metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
created_at timestamptz NOT NULL DEFAULT now(),
completed_at timestamptz
);
CREATE INDEX prompts_repository_created_at_idx ON prompts (repository_id, created_at DESC);