12 lines
504 B
SQL
12 lines
504 B
SQL
CREATE TABLE IF NOT EXISTS "FlowBoardDraft" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"userId" uuid NOT NULL REFERENCES "User"("id") ON DELETE cascade,
|
|
"snapshot" jsonb NOT NULL DEFAULT '{"children":[]}'::jsonb,
|
|
"createdAt" timestamp NOT NULL DEFAULT now(),
|
|
"updatedAt" timestamp NOT NULL DEFAULT now(),
|
|
CONSTRAINT "FlowBoardDraft_userId_unique" UNIQUE("userId")
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS "FlowBoardDraft_user_updated_idx"
|
|
ON "FlowBoardDraft"("userId", "updatedAt");
|