ai-chatbot/lib/db/migrations/0038_add_canvas_detail_archives.sql
Your Name 81c1e955cb
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: persist canvas detail archives and extend detail metadata
2026-02-19 13:14:05 +08:00

21 lines
819 B
SQL

CREATE TABLE IF NOT EXISTS "CanvasDetailArchive" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"projectId" uuid NOT NULL REFERENCES "CanvasProject"("id") ON DELETE cascade,
"userId" uuid NOT NULL REFERENCES "User"("id") ON DELETE cascade,
"title" varchar(256) NOT NULL DEFAULT 'AI详情项目',
"prompt" text NOT NULL DEFAULT '',
"brief" jsonb NOT NULL,
"slots" jsonb NOT NULL,
"summary" text,
"imageCount" integer,
"coverUrl" text,
"createdAt" timestamp NOT NULL DEFAULT now(),
"updatedAt" timestamp NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS "canvas_detail_archive_project_created_idx"
ON "CanvasDetailArchive" ("projectId", "createdAt" DESC);
CREATE INDEX IF NOT EXISTS "canvas_detail_archive_user_created_idx"
ON "CanvasDetailArchive" ("userId", "createdAt" DESC);