Open History to see the last commit
1CREATE TABLE "ai_generations" (
2 "id" uuid PRIMARY KEY NOT NULL,
3 "guest" uuid NOT NULL,
4 "prompt" text NOT NULL,
5 "model" text NOT NULL,
6 "status" text DEFAULT 'queued' NOT NULL,
7 "attempt" integer DEFAULT 0 NOT NULL,
8 "blueprint" jsonb,
9 "issues" jsonb,
10 "error" text,
11 "input_tokens" integer DEFAULT 0 NOT NULL,
12 "output_tokens" integer DEFAULT 0 NOT NULL,
13 "world" uuid,
14 "lease_until" timestamp with time zone,
15 "created_at" timestamp with time zone DEFAULT now() NOT NULL,
16 "updated_at" timestamp with time zone DEFAULT now() NOT NULL
17);
18--> statement-breakpoint
19ALTER TABLE "ai_generations" ADD CONSTRAINT "ai_generations_world_worlds_id_fk" FOREIGN KEY ("world") REFERENCES "public"."worlds"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
20CREATE INDEX "ai_generations_guest_created" ON "ai_generations" USING btree ("guest","created_at");--> statement-breakpoint
21CREATE INDEX "ai_generations_status_lease" ON "ai_generations" USING btree ("status","lease_until");