22 lines
1023 B
SQL
22 lines
1023 B
SQL
CREATE TYPE "public"."backlog_status" AS ENUM('ready', 'claimed', 'blocked', 'done');--> statement-breakpoint
|
|
CREATE TABLE "backlog" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"title" text NOT NULL,
|
|
"body" text,
|
|
"phase" text,
|
|
"priority" integer DEFAULT 0 NOT NULL,
|
|
"status" "backlog_status" DEFAULT 'ready' NOT NULL,
|
|
"depends_on" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
"claim_owner" text,
|
|
"claim_ttl_seconds" integer,
|
|
"claimed_at" timestamp with time zone,
|
|
"attempts" integer DEFAULT 0 NOT NULL,
|
|
"idempotency_key" text,
|
|
"acceptance" jsonb,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX "backlog_status_priority_idx" ON "backlog" USING btree ("status","priority");--> statement-breakpoint
|
|
CREATE INDEX "backlog_status_claimed_at_idx" ON "backlog" USING btree ("status","claimed_at");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX "backlog_idempotency_key_idx" ON "backlog" USING btree ("idempotency_key"); |