From 6d0fc93138d5da8a0a8562d69d61644bf4fb4c46 Mon Sep 17 00:00:00 2001 From: greysoh Date: Wed, 17 Apr 2024 11:34:31 -0400 Subject: [PATCH] fix: Adds password into User schema. --- .../20240417153312_fix_add_pw/migration.sql | 21 +++++++++++++++++++ prisma/schema.prisma | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 prisma/migrations/20240417153312_fix_add_pw/migration.sql diff --git a/prisma/migrations/20240417153312_fix_add_pw/migration.sql b/prisma/migrations/20240417153312_fix_add_pw/migration.sql new file mode 100644 index 0000000..8035bde --- /dev/null +++ b/prisma/migrations/20240417153312_fix_add_pw/migration.sql @@ -0,0 +1,21 @@ +/* + Warnings: + + - Added the required column `password` to the `User` table without a default value. This is not possible if the table is not empty. + +*/ +-- RedefineTables +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_User" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "email" TEXT NOT NULL, + "name" TEXT, + "password" TEXT NOT NULL, + "rootToken" TEXT +); +INSERT INTO "new_User" ("email", "id", "name", "rootToken") SELECT "email", "id", "name", "rootToken" FROM "User"; +DROP TABLE "User"; +ALTER TABLE "new_User" RENAME TO "User"; +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); +PRAGMA foreign_key_check; +PRAGMA foreign_keys=ON; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 820777e..fbc790a 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -50,6 +50,8 @@ model User { email String @unique name String? + password String // Will be hashed using bcrypt + rootToken String? permissions Permission[] }