Skip to content

Commit

Permalink
chore: upgrade to prisma v5 (#150)
Browse files Browse the repository at this point in the history
* chore: upgrade prisma packages

* chore: adjust schema for v5

* chore: baseline db
  • Loading branch information
Krish120003 authored Nov 4, 2023
1 parent aff79ff commit d051dab
Show file tree
Hide file tree
Showing 16 changed files with 154 additions and 202 deletions.
39 changes: 19 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@fullcalendar/react": "^6.0.2",
"@fullcalendar/timegrid": "^6.0.2",
"@next-auth/prisma-adapter": "^1.0.4",
"@prisma/client": "^4.8.0",
"@prisma/client": "^5.5.2",
"@sendgrid/mail": "^7.7.0",
"@syncfusion/ej2-react-schedule": "^20.4.43",
"@tanstack/react-query": "^4.35.7",
Expand Down Expand Up @@ -64,7 +64,7 @@
"postcss": "^8.4.16",
"prettier": "^2.8.2",
"prettier-plugin-tailwindcss": "^0.1.13",
"prisma": "^4.8.0",
"prisma": "^5.5.2",
"tailwindcss": "^3.1.8",
"typescript": "4.7.4"
},
Expand Down
115 changes: 115 additions & 0 deletions prisma/migrations/0_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
-- CreateEnum
CREATE TYPE "Role" AS ENUM ('HACKER', 'ADMIN', 'REVIEWER', 'FOOD_MANAGER', 'EVENT_MANAGER', 'GENERAL_SCANNER', 'SPONSER');

-- CreateEnum
CREATE TYPE "Status" AS ENUM ('IN_REVIEW', 'REJECTED', 'WAITLISTED', 'ACCEPTED', 'RSVP', 'CHECKED_IN');

-- CreateTable
CREATE TABLE "Account" (
"id" STRING NOT NULL,
"userId" STRING NOT NULL,
"type" STRING NOT NULL,
"provider" STRING NOT NULL,
"providerAccountId" STRING NOT NULL,
"refresh_token" STRING,
"refresh_token_expires_in" INT4,
"access_token" STRING,
"expires_at" INT4,
"ext_expires_in" INT4,
"oauth_token_secret" STRING,
"oauth_token" STRING,
"token_type" STRING,
"scope" STRING,
"id_token" STRING,
"session_state" STRING,

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

-- CreateTable
CREATE TABLE "Session" (
"id" STRING NOT NULL,
"sessionToken" STRING NOT NULL,
"userId" STRING NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,

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

-- CreateTable
CREATE TABLE "User" (
"id" STRING NOT NULL,
"name" STRING,
"email" STRING,
"emailVerified" TIMESTAMP(3),
"image" STRING,
"typeform_response_id" STRING,
"role" "Role"[] DEFAULT ARRAY['HACKER']::"Role"[],
"status" "Status" NOT NULL DEFAULT 'IN_REVIEW',
"qrcode" INT4,
"mealsTaken" INT4 NOT NULL DEFAULT 0,
"lastMealTaken" TIMESTAMP(3),

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

-- CreateTable
CREATE TABLE "Review" (
"id" STRING NOT NULL,
"hackerId" STRING NOT NULL,
"reviewerId" STRING NOT NULL,
"mark" FLOAT8 NOT NULL DEFAULT 0,

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

-- CreateTable
CREATE TABLE "EventLog" (
"id" STRING NOT NULL,
"userId" STRING NOT NULL,
"timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"event" STRING NOT NULL,

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

-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" STRING NOT NULL,
"token" STRING NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);

-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");

-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");

-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");

-- CreateIndex
CREATE UNIQUE INDEX "User_qrcode_key" ON "User"("qrcode");

-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");

-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");

-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Review" ADD CONSTRAINT "Review_hackerId_fkey" FOREIGN KEY ("hackerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Review" ADD CONSTRAINT "Review_reviewerId_fkey" FOREIGN KEY ("reviewerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "EventLog" ADD CONSTRAINT "EventLog_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

77 changes: 0 additions & 77 deletions prisma/migrations/20221112203343_initial_migration/migration.sql

This file was deleted.

14 changes: 0 additions & 14 deletions prisma/migrations/20221112204243_add_roles/migration.sql

This file was deleted.

15 changes: 0 additions & 15 deletions prisma/migrations/20221115184153_add_reviews/migration.sql

This file was deleted.

5 changes: 0 additions & 5 deletions prisma/migrations/20230104055428_add_statuses/migration.sql

This file was deleted.

11 changes: 0 additions & 11 deletions prisma/migrations/20230109002233_add_qr_code_field/migration.sql

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions prisma/migrations/20230113051706_add_other_roles/migration.sql

This file was deleted.

12 changes: 0 additions & 12 deletions prisma/migrations/20230113051945_add_event_log/migration.sql

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions prisma/migrations/migration_lock.toml

This file was deleted.

Loading

0 comments on commit d051dab

Please sign in to comment.