full-stack-school/supabase/migrations/20260301213013_create_lesson_whiteboard.sql

20 lines
717 B
SQL

-- CreateTable LessonWhiteboard
CREATE TABLE "LessonWhiteboard" (
"id" SERIAL NOT NULL,
"lessonId" INTEGER NOT NULL,
"title" TEXT,
"plannedSnapshotData" JSONB,
"liveSnapshotData" JSONB,
"finalSnapshotData" JSONB,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "LessonWhiteboard_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "LessonWhiteboard" ADD CONSTRAINT "LessonWhiteboard_lessonId_fkey" FOREIGN KEY ("lessonId") REFERENCES "Lesson"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- CreateIndex
CREATE UNIQUE INDEX "LessonWhiteboard_lessonId_key" ON "LessonWhiteboard"("lessonId");