ai-chatbot/lib/db/migrations/0069_add_flow_board_drafts.sql
Your Name d88c28356a
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: add flow board with database drafts
2026-04-11 20:48:46 +08:00

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