From a73187d46bc2fa363cd3d57d1486d383d25bcec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Tue, 12 Oct 2021 04:09:39 -0600 Subject: [PATCH] Makes fields with default values not null (#903) * Makes fields with default values non-optional * Removes PeriodType enum for now * Adds missing migrations Co-authored-by: Bailey Pumfleet --- .../20211011152041_non_optionals/migration.sql | 16 ++++++++++++++++ prisma/schema.prisma | 12 ++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 prisma/migrations/20211011152041_non_optionals/migration.sql diff --git a/prisma/migrations/20211011152041_non_optionals/migration.sql b/prisma/migrations/20211011152041_non_optionals/migration.sql new file mode 100644 index 00000000..4114e45b --- /dev/null +++ b/prisma/migrations/20211011152041_non_optionals/migration.sql @@ -0,0 +1,16 @@ +/* + Warnings: + + - Made the column `periodType` on table `EventType` required. This step will fail if there are existing NULL values in that column. + - Made the column `email` on table `users` required. This step will fail if there are existing NULL values in that column. + - Made the column `weekStart` on table `users` required. This step will fail if there are existing NULL values in that column. + - Made the column `completedOnboarding` on table `users` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE "EventType" ALTER COLUMN "periodType" SET NOT NULL; + +-- AlterTable +ALTER TABLE "users" ALTER COLUMN "email" SET NOT NULL, +ALTER COLUMN "weekStart" SET NOT NULL, +ALTER COLUMN "completedOnboarding" SET NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index ffe55f7c..a6991add 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -33,7 +33,7 @@ model EventType { eventName String? customInputs EventTypeCustomInput[] timeZone String? - periodType String? @default("unlimited") // unlimited | rolling | range + periodType String @default("unlimited") // unlimited | rolling | range periodStartDate DateTime? periodEndDate DateTime? periodDays Int? @@ -43,8 +43,8 @@ model EventType { minimumBookingNotice Int @default(120) schedulingType SchedulingType? Schedule Schedule[] - price Int @default(0) - currency String @default("usd") + price Int @default(0) + currency String @default("usd") @@unique([userId, slug]) } @@ -66,13 +66,13 @@ model User { id Int @id @default(autoincrement()) username String? @unique name String? - email String? @unique + email String @unique emailVerified DateTime? password String? bio String? avatar String? timeZone String @default("Europe/London") - weekStart String? @default("Sunday") + weekStart String @default("Sunday") startTime Int @default(0) endTime Int @default(1440) bufferTime Int @default(0) @@ -85,7 +85,7 @@ model User { bookings Booking[] availability Availability[] selectedCalendars SelectedCalendar[] - completedOnboarding Boolean? @default(false) + completedOnboarding Boolean @default(false) locale String? twoFactorSecret String? twoFactorEnabled Boolean @default(false)