From 96f6fd1bd3747546f1e976953c80c1500ea20563 Mon Sep 17 00:00:00 2001 From: Damian <37555910+DCRepublic@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:28:21 -0500 Subject: [PATCH] Prisma fixing --- .../migration.sql | 41 +++++++++++++++++++ .../20241127002525_test/migration.sql | 11 +++++ prisma/schema.prisma | 3 +- swatscraper | 2 +- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20241125212024_change_faculty/migration.sql create mode 100644 prisma/migrations/20241127002525_test/migration.sql diff --git a/prisma/migrations/20241125212024_change_faculty/migration.sql b/prisma/migrations/20241125212024_change_faculty/migration.sql new file mode 100644 index 0000000..d00d3ae --- /dev/null +++ b/prisma/migrations/20241125212024_change_faculty/migration.sql @@ -0,0 +1,41 @@ +/* + Warnings: + + - You are about to drop the column `courseID` on the `Rating` table. All the data in the column will be lost. + - You are about to drop the column `facultyID` on the `Rating` table. All the data in the column will be lost. + - A unique constraint covering the columns `[uid]` on the table `Faculty` will be added. If there are existing duplicate values, this will fail. + - Added the required column `courseName` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `courseNumber` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `courseSubject` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `profBannerId` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `profDisplayName` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `termTaken` to the `Rating` table without a default value. This is not possible if the table is not empty. + - Added the required column `yearTaken` to the `Rating` table without a default value. This is not possible if the table is not empty. + +*/ +-- DropForeignKey +ALTER TABLE "Rating" DROP CONSTRAINT "Rating_courseID_fkey"; + +-- DropForeignKey +ALTER TABLE "Rating" DROP CONSTRAINT "Rating_facultyID_fkey"; + +-- AlterTable +ALTER TABLE "Faculty" ADD COLUMN "uid" TEXT NOT NULL DEFAULT 'undefined'; + +-- AlterTable +ALTER TABLE "Rating" DROP COLUMN "courseID", +DROP COLUMN "facultyID", +ADD COLUMN "courseName" TEXT NOT NULL, +ADD COLUMN "courseNumber" TEXT NOT NULL, +ADD COLUMN "courseSubject" TEXT NOT NULL, +ADD COLUMN "facultyId" INTEGER, +ADD COLUMN "profBannerId" TEXT NOT NULL, +ADD COLUMN "profDisplayName" TEXT NOT NULL, +ADD COLUMN "termTaken" INTEGER NOT NULL, +ADD COLUMN "yearTaken" INTEGER NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "Faculty_uid_key" ON "Faculty"("uid"); + +-- AddForeignKey +ALTER TABLE "Rating" ADD CONSTRAINT "Rating_facultyId_fkey" FOREIGN KEY ("facultyId") REFERENCES "Faculty"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20241127002525_test/migration.sql b/prisma/migrations/20241127002525_test/migration.sql new file mode 100644 index 0000000..3b7e93b --- /dev/null +++ b/prisma/migrations/20241127002525_test/migration.sql @@ -0,0 +1,11 @@ +/* + Warnings: + + - Made the column `profUid` on table `Rating` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE "Faculty" ALTER COLUMN "uid" DROP DEFAULT; + +-- AlterTable +ALTER TABLE "Rating" ALTER COLUMN "profUid" SET NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 137e204..e729855 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -118,8 +118,7 @@ model Rating { profBannerId String yearTaken Int termTaken String - profUid String? - + profUid String overallRating Int? difficulty Int? takeAgain Boolean? diff --git a/swatscraper b/swatscraper index 9a516e5..c6f63ce 160000 --- a/swatscraper +++ b/swatscraper @@ -1 +1 @@ -Subproject commit 9a516e53feae78416d2147eb934604e890677a18 +Subproject commit c6f63ce68b3ec3827001c48b62624bf643d15648