ai-chatbot/lib/db/migrations/0068_add_agent_psd_render_tasks.sql
Your Name 6648f43a20
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: queue psd template exports
2026-04-10 23:04:38 +08:00

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");