22 lines
1.8 KiB
MySQL
22 lines
1.8 KiB
MySQL
|
|
CREATE TABLE "worker_checkpoints" (
|
||
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||
|
|
"workspace_id" uuid NOT NULL,
|
||
|
|
"agent_run_id" uuid NOT NULL,
|
||
|
|
"convoy_id" uuid NOT NULL,
|
||
|
|
"brief_id" uuid,
|
||
|
|
"role_id" varchar(64) NOT NULL,
|
||
|
|
"checkpoint_seq" integer NOT NULL,
|
||
|
|
"tool_history" jsonb NOT NULL,
|
||
|
|
"files_touched" jsonb NOT NULL,
|
||
|
|
"branch" varchar(255),
|
||
|
|
"worktree_path" text,
|
||
|
|
"occurred_at" timestamp with time zone DEFAULT now() NOT NULL
|
||
|
|
);
|
||
|
|
--> statement-breakpoint
|
||
|
|
ALTER TABLE "worker_checkpoints" ADD CONSTRAINT "worker_checkpoints_workspace_id_workspaces_id_fk" FOREIGN KEY ("workspace_id") REFERENCES "public"."workspaces"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||
|
|
ALTER TABLE "worker_checkpoints" ADD CONSTRAINT "worker_checkpoints_agent_run_id_agent_runs_id_fk" FOREIGN KEY ("agent_run_id") REFERENCES "public"."agent_runs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||
|
|
ALTER TABLE "worker_checkpoints" ADD CONSTRAINT "worker_checkpoints_convoy_id_objects_id_fk" FOREIGN KEY ("convoy_id") REFERENCES "public"."objects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||
|
|
ALTER TABLE "worker_checkpoints" ADD CONSTRAINT "worker_checkpoints_brief_id_objects_id_fk" FOREIGN KEY ("brief_id") REFERENCES "public"."objects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||
|
|
CREATE INDEX "worker_checkpoints_workspace_id_occurred_at_idx" ON "worker_checkpoints" USING btree ("workspace_id","occurred_at" DESC NULLS LAST);--> statement-breakpoint
|
||
|
|
CREATE UNIQUE INDEX "worker_checkpoints_agent_run_id_seq_idx" ON "worker_checkpoints" USING btree ("agent_run_id","checkpoint_seq");--> statement-breakpoint
|
||
|
|
CREATE INDEX "worker_checkpoints_convoy_id_occurred_at_idx" ON "worker_checkpoints" USING btree ("convoy_id","occurred_at" DESC NULLS LAST);
|