20 lines
733 B
SQL
20 lines
733 B
SQL
CREATE TABLE IF NOT EXISTS "AgentPsdRenderTask" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"userId" uuid NOT NULL REFERENCES "User"("id") ON DELETE cascade,
|
|
"status" varchar(16) NOT NULL DEFAULT 'pending',
|
|
"request" jsonb NOT NULL,
|
|
"result" jsonb,
|
|
"error" text,
|
|
"attempts" integer NOT NULL DEFAULT 0,
|
|
"startedAt" timestamp,
|
|
"completedAt" timestamp,
|
|
"createdAt" timestamp NOT NULL DEFAULT now(),
|
|
"updatedAt" timestamp NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS "AgentPsdRenderTask_user_status_created_idx"
|
|
ON "AgentPsdRenderTask"("userId", "status", "createdAt");
|
|
|
|
CREATE INDEX IF NOT EXISTS "AgentPsdRenderTask_status_created_idx"
|
|
ON "AgentPsdRenderTask"("status", "createdAt");
|