21 lines
819 B
SQL
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);
|