-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: upgrade prisma packages * chore: adjust schema for v5 * chore: baseline db
- Loading branch information
1 parent
aff79ff
commit d051dab
Showing
16 changed files
with
154 additions
and
202 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
77
prisma/migrations/20221112203343_initial_migration/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
prisma/migrations/20221115184153_add_reviews/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
prisma/migrations/20230109002233_add_qr_code_field/migration.sql
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
prisma/migrations/20230112043530_add_meal_counter/migration.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
prisma/migrations/20230112063406_add_food_manager_role/migration.sql
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
prisma/migrations/20230113051706_add_other_roles/migration.sql
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
prisma/migrations/20230113051945_add_event_log/migration.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
prisma/migrations/20230113052447_add_sponser_role/migration.sql
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
prisma/migrations/20230906034517_add_nextauth_expiry/migration.sql
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.