22 lines
1.1 KiB
SQL
22 lines
1.1 KiB
SQL
CREATE TABLE "check_runs" (
|
|
"id" serial PRIMARY KEY NOT NULL,
|
|
"project_id" integer NOT NULL,
|
|
"task_id" integer,
|
|
"sha" text NOT NULL,
|
|
"branch" text,
|
|
"pr_number" integer,
|
|
"check" text NOT NULL,
|
|
"state" text NOT NULL,
|
|
"run_url" text,
|
|
"log_tail" text,
|
|
"duration_sec" integer,
|
|
"source" text DEFAULT 'report' NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE "tasks" ADD COLUMN "ci_attempts" integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "tasks" ADD COLUMN "ci_failed_sha" text;--> statement-breakpoint
|
|
ALTER TABLE "check_runs" ADD CONSTRAINT "check_runs_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
ALTER TABLE "check_runs" ADD CONSTRAINT "check_runs_task_id_tasks_id_fk" FOREIGN KEY ("task_id") REFERENCES "public"."tasks"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "check_runs_project_sha_check" ON "check_runs" USING btree ("project_id","sha","check"); |