Skip to content

Commit

Permalink
chore: update prisma schema and migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
sjschlapbach committed Aug 15, 2024
1 parent 08b6fe4 commit f2558e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/*
Warnings:
- Made the column `color` on table `Course` required. This step will fail if there are existing NULL values in that column.
- Made the column `order` on table `SessionBlock` required. This step will fail if there are existing NULL values in that column.
*/

-- CreateTable
CREATE TABLE "AnalyticsDaily" (
"id" SERIAL NOT NULL,
Expand All @@ -16,13 +8,13 @@ CREATE TABLE "AnalyticsDaily" (
"totalXp" DOUBLE PRECISION NOT NULL,
"collectedAchievements" TEXT[],
"participantId" UUID NOT NULL,
"courseId" UUID NOT NULL,
"courseId" UUID,

CONSTRAINT "AnalyticsDaily_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "AnalyticsDaily" ADD CONSTRAINT "AnalyticsDaily_participantId_fkey" FOREIGN KEY ("participantId") REFERENCES "Participant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE "AnalyticsDaily" ADD CONSTRAINT "AnalyticsDaily_participantId_fkey" FOREIGN KEY ("participantId") REFERENCES "Participant"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "AnalyticsDaily" ADD CONSTRAINT "AnalyticsDaily_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
ALTER TABLE "AnalyticsDaily" ADD CONSTRAINT "AnalyticsDaily_courseId_fkey" FOREIGN KEY ("courseId") REFERENCES "Course"("id") ON DELETE CASCADE ON UPDATE CASCADE;
6 changes: 3 additions & 3 deletions packages/prisma/src/prisma/schema/analytics.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ model AnalyticsDaily {
collectedAchievements String[]
participant Participant @relation(fields: [participantId], references: [id])
participant Participant @relation(fields: [participantId], references: [id], onDelete: Cascade, onUpdate: Cascade)
participantId String @db.Uuid
course Course @relation(fields: [courseId], references: [id])
courseId String @db.Uuid
course Course? @relation(fields: [courseId], references: [id], onDelete: Cascade, onUpdate: Cascade)
courseId String? @db.Uuid
}

0 comments on commit f2558e8

Please sign in to comment.