From c25e955a1eac143a80e560ea5babe1984dfa3aa3 Mon Sep 17 00:00:00 2001 From: William Moraes Date: Mon, 3 Jun 2024 20:44:51 -0300 Subject: [PATCH] feat: :sparkles: add migration to turn uuid required --- .../migration.sql | 12 ++++++++++++ prisma/schema.prisma | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 prisma/migrations/20240603234056_update_uuid_to_be_required/migration.sql diff --git a/prisma/migrations/20240603234056_update_uuid_to_be_required/migration.sql b/prisma/migrations/20240603234056_update_uuid_to_be_required/migration.sql new file mode 100644 index 0000000..93c09ff --- /dev/null +++ b/prisma/migrations/20240603234056_update_uuid_to_be_required/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - A unique constraint covering the columns `[uuid]` on the table `Shelter` will be added. If there are existing duplicate values, this will fail. + - Made the column `uuid` on table `Shelter` required. This step will fail if there are existing NULL values in that column. + +*/ +-- AlterTable +ALTER TABLE "Shelter" ALTER COLUMN "uuid" SET NOT NULL; + +-- CreateIndex +CREATE UNIQUE INDEX "Shelter_uuid_key" ON "Shelter"("uuid"); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 2495716..cb11e48 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -16,7 +16,7 @@ datasource db { model Shelter { id Int @id @default(autoincrement()) - uuid String? @default(cuid()) + uuid String @unique @default(cuid()) name String createdAt DateTime @default(now()) updatedAt DateTime @updatedAt