From 20be4e6ed78af5c935f187c0da8652f5702a1d52 Mon Sep 17 00:00:00 2001 From: Weronika Tomaszewska Date: Fri, 16 Feb 2024 16:12:39 -0500 Subject: [PATCH] CPF-103 add 'unique' field attribute to user email --- .../20240216211114_make_user_email_unique/migration.sql | 8 ++++++++ api/db/schema.prisma | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 api/db/migrations/20240216211114_make_user_email_unique/migration.sql diff --git a/api/db/migrations/20240216211114_make_user_email_unique/migration.sql b/api/db/migrations/20240216211114_make_user_email_unique/migration.sql new file mode 100644 index 00000000..5e77f8e9 --- /dev/null +++ b/api/db/migrations/20240216211114_make_user_email_unique/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - A unique constraint covering the columns `[email]` on the table `User` will be added. If there are existing duplicate values, this will fail. + +*/ +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); diff --git a/api/db/schema.prisma b/api/db/schema.prisma index 11bf84aa..a09fb88b 100644 --- a/api/db/schema.prisma +++ b/api/db/schema.prisma @@ -35,7 +35,7 @@ model Organization { model User { id Int @id @default(autoincrement()) - email String + email String @unique name String agencyId Int createdAt DateTime @default(now()) @db.Timestamptz(6)