From ee29b1d336fccc6a5c676534f54f07729ec889f5 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Tue, 5 Nov 2024 21:55:03 +0000 Subject: [PATCH] Create the migration file so the DB can store meetings. --- .../20241105215343_meetings/migration.sql | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 prisma/migrations/20241105215343_meetings/migration.sql diff --git a/prisma/migrations/20241105215343_meetings/migration.sql b/prisma/migrations/20241105215343_meetings/migration.sql new file mode 100644 index 0000000..323a31f --- /dev/null +++ b/prisma/migrations/20241105215343_meetings/migration.sql @@ -0,0 +1,53 @@ +-- CreateTable +CREATE TABLE "Meeting" ( + "year" INTEGER NOT NULL, + "name" TEXT NOT NULL, + "minutesUrl" TEXT NOT NULL, + "minutesId" TEXT NOT NULL, + "cachedMinutesId" TEXT, + "contents" TEXT +); + +-- CreateTable +CREATE TABLE "MeetingSession" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "meetingYear" INTEGER NOT NULL, + "meetingName" TEXT NOT NULL, + "type" TEXT NOT NULL, + CONSTRAINT "MeetingSession_meetingYear_meetingName_fkey" FOREIGN KEY ("meetingYear", "meetingName") REFERENCES "Meeting" ("year", "name") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "MeetingAttendee" ( + "sessionId" INTEGER NOT NULL, + "attendeeId" TEXT NOT NULL, + CONSTRAINT "MeetingAttendee_sessionId_fkey" FOREIGN KEY ("sessionId") REFERENCES "MeetingSession" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "Discussion" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "designReviewId" TEXT NOT NULL, + "meetingYear" INTEGER NOT NULL, + "meetingName" TEXT NOT NULL, + "markdown" TEXT NOT NULL, + CONSTRAINT "Discussion_designReviewId_fkey" FOREIGN KEY ("designReviewId") REFERENCES "DesignReview" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT "Discussion_meetingYear_meetingName_fkey" FOREIGN KEY ("meetingYear", "meetingName") REFERENCES "Meeting" ("year", "name") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "ProposedComment" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "discussionId" INTEGER, + "markdown" TEXT NOT NULL, + CONSTRAINT "ProposedComment_discussionId_fkey" FOREIGN KEY ("discussionId") REFERENCES "Discussion" ("id") ON DELETE CASCADE ON UPDATE CASCADE +); + +-- CreateIndex +CREATE UNIQUE INDEX "Meeting_year_name_key" ON "Meeting"("year", "name"); + +-- CreateIndex +CREATE UNIQUE INDEX "MeetingSession_meetingYear_meetingName_type_key" ON "MeetingSession"("meetingYear", "meetingName", "type"); + +-- CreateIndex +CREATE UNIQUE INDEX "MeetingAttendee_sessionId_attendeeId_key" ON "MeetingAttendee"("sessionId", "attendeeId");