Skip to content

Commit

Permalink
Prisma fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
DCRepublic committed Nov 27, 2024
1 parent 9661da3 commit 96f6fd1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
41 changes: 41 additions & 0 deletions prisma/migrations/20241125212024_change_faculty/migration.sql
Original file line number Diff line number Diff line change
@@ -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;
11 changes: 11 additions & 0 deletions prisma/migrations/20241127002525_test/migration.sql
Original file line number Diff line number Diff line change
@@ -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;
3 changes: 1 addition & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ model Rating {
profBannerId String
yearTaken Int
termTaken String
profUid String?
profUid String
overallRating Int?
difficulty Int?
takeAgain Boolean?
Expand Down
2 changes: 1 addition & 1 deletion swatscraper
Submodule swatscraper updated 1 files
+1 −1 main.go

0 comments on commit 96f6fd1

Please sign in to comment.