From b804fafc42595deafc639e4639356746bae03850 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:56:15 +0700 Subject: [PATCH] refactor: customer db --- .../20240409065557_update_customer/migration.sql | 14 ++++++++++++++ prisma/schema.prisma | 10 +++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 prisma/migrations/20240409065557_update_customer/migration.sql diff --git a/prisma/migrations/20240409065557_update_customer/migration.sql b/prisma/migrations/20240409065557_update_customer/migration.sql new file mode 100644 index 0000000..f5291b9 --- /dev/null +++ b/prisma/migrations/20240409065557_update_customer/migration.sql @@ -0,0 +1,14 @@ +/* + Warnings: + + - You are about to drop the column `imageUrl` on the `Customer` table. All the data in the column will be lost. + - Changed the type of `customerType` on the `Customer` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. + +*/ +-- CreateEnum +CREATE TYPE "CustomerType" AS ENUM ('CORP', 'PERS'); + +-- AlterTable +ALTER TABLE "Customer" DROP COLUMN "imageUrl", +DROP COLUMN "customerType", +ADD COLUMN "customerType" "CustomerType" NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index cc45b79..c30c61e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -208,13 +208,17 @@ model User { branch BranchUser[] } +enum CustomerType { + CORP + PERS +} + model Customer { - id String @id @default(uuid()) + id String @id @default(uuid()) code String - customerType String + customerType CustomerType customerName String customerNameEN String - imageUrl String? status Status @default(CREATED)