This repository has been archived by the owner on Feb 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #69 from PRIME-TU-Delft/db-improve-roles-links
Broken auth & improved db schema
- Loading branch information
Showing
13 changed files
with
543 additions
and
17 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -39,6 +39,8 @@ | |
"type": "module", | ||
"packageManager": "[email protected]", | ||
"dependencies": { | ||
"@auth/prisma-adapter": "^2.4.1", | ||
"@auth/sveltekit": "^1.4.1", | ||
"@types/d3": "^7.4.3", | ||
"@types/uuid": "^10.0.0", | ||
"d3": "^7.9.0", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
prisma/migrations/20240717184305_auth_js_models/migration.sql
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,93 @@ | ||
/* | ||
Warnings: | ||
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint. | ||
- You are about to drop the column `first_name` on the `User` table. All the data in the column will be lost. | ||
- You are about to drop the column `last_name` on the `User` table. All the data in the column will be lost. | ||
- You are about to drop the column `netid` on the `User` table. All the data in the column will be lost. | ||
- You are about to drop the column `role` on the `User` table. All the data in the column will be lost. | ||
- A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail. | ||
- Added the required column `updatedAt` to the `User` table without a default value. This is not possible if the table is not empty. | ||
- Made the column `email` on table `User` required. This step will fail if there are existing NULL values in that column. | ||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "_ProgramToUser" DROP CONSTRAINT "_ProgramToUser_B_fkey"; | ||
|
||
-- DropIndex | ||
DROP INDEX "User_netid_key"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "User" DROP CONSTRAINT "User_pkey", | ||
DROP COLUMN "first_name", | ||
DROP COLUMN "last_name", | ||
DROP COLUMN "netid", | ||
DROP COLUMN "role", | ||
ADD COLUMN "emailVerified" TIMESTAMP(3), | ||
ADD COLUMN "firstName" TEXT, | ||
ADD COLUMN "image" TEXT, | ||
ADD COLUMN "lastName" TEXT, | ||
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL, | ||
ALTER COLUMN "id" DROP DEFAULT, | ||
ALTER COLUMN "id" SET DATA TYPE TEXT, | ||
ALTER COLUMN "email" SET NOT NULL, | ||
ADD CONSTRAINT "User_pkey" PRIMARY KEY ("id"); | ||
DROP SEQUENCE "User_id_seq"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "_ProgramToUser" ALTER COLUMN "B" SET DATA TYPE TEXT; | ||
|
||
-- DropEnum | ||
DROP TYPE "UserRole"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "Account" ( | ||
"userId" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"provider" TEXT NOT NULL, | ||
"providerAccountId" TEXT NOT NULL, | ||
"refresh_token" TEXT, | ||
"access_token" TEXT, | ||
"expires_at" INTEGER, | ||
"token_type" TEXT, | ||
"scope" TEXT, | ||
"id_token" TEXT, | ||
"session_state" TEXT, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "Account_pkey" PRIMARY KEY ("provider","providerAccountId") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Session" ( | ||
"sessionToken" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "VerificationToken" ( | ||
"identifier" TEXT NOT NULL, | ||
"token" TEXT NOT NULL, | ||
"expires" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "VerificationToken_pkey" PRIMARY KEY ("identifier","token") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); | ||
|
||
-- 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 "_ProgramToUser" ADD CONSTRAINT "_ProgramToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
Oops, something went wrong.