refactor: customer structure
This commit is contained in:
parent
eaf8ce3fd1
commit
4dee7bfe71
4 changed files with 156 additions and 79 deletions
37
prisma/migrations/20240913062608_update_fields/migration.sql
Normal file
37
prisma/migrations/20240913062608_update_fields/migration.sql
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `birthDate` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `firstName` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `firstNameEN` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `gender` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `lastName` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `lastNameEN` on the `Customer` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `namePrefix` on the `Customer` table. All the data in the column will be lost.
|
||||
- Made the column `registeredBranchId` on table `Customer` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Customer" DROP CONSTRAINT "Customer_registeredBranchId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Customer" DROP COLUMN "birthDate",
|
||||
DROP COLUMN "firstName",
|
||||
DROP COLUMN "firstNameEN",
|
||||
DROP COLUMN "gender",
|
||||
DROP COLUMN "lastName",
|
||||
DROP COLUMN "lastNameEN",
|
||||
DROP COLUMN "namePrefix",
|
||||
ALTER COLUMN "registeredBranchId" SET NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "CustomerBranch" ADD COLUMN "birthDate" DATE,
|
||||
ADD COLUMN "firstName" TEXT,
|
||||
ADD COLUMN "firstNameEN" TEXT,
|
||||
ADD COLUMN "gender" TEXT,
|
||||
ADD COLUMN "lastName" TEXT,
|
||||
ADD COLUMN "lastNameEN" TEXT,
|
||||
ADD COLUMN "namePrefix" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Customer" ADD CONSTRAINT "Customer_registeredBranchId_fkey" FOREIGN KEY ("registeredBranchId") REFERENCES "Branch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
|
@ -420,22 +420,6 @@ model Customer {
|
|||
id String @id @default(cuid())
|
||||
|
||||
customerType CustomerType
|
||||
telephoneNo String
|
||||
|
||||
namePrefix String?
|
||||
firstName String?
|
||||
firstNameEN String?
|
||||
lastName String?
|
||||
lastNameEN String?
|
||||
gender String?
|
||||
birthDate DateTime? @db.Date
|
||||
citizenId String?
|
||||
|
||||
legalPersonNo String?
|
||||
registerName String?
|
||||
registerNameEN String?
|
||||
businessType String?
|
||||
jobPosition String?
|
||||
|
||||
status Status @default(CREATED)
|
||||
statusOrder Int @default(0)
|
||||
|
|
@ -464,8 +448,18 @@ model CustomerBranch {
|
|||
code String
|
||||
codeCustomer String
|
||||
|
||||
telephoneNo String
|
||||
|
||||
// NOTE: About (Natural Person)
|
||||
citizenId String?
|
||||
namePrefix String?
|
||||
firstName String?
|
||||
firstNameEN String?
|
||||
lastName String?
|
||||
lastNameEN String?
|
||||
gender String?
|
||||
birthDate DateTime? @db.Date
|
||||
citizenId String?
|
||||
|
||||
// NOTE: About (Legal Entity)
|
||||
legalPersonNo String?
|
||||
registerName String?
|
||||
|
|
@ -496,7 +490,6 @@ model CustomerBranch {
|
|||
|
||||
email String
|
||||
contactName String
|
||||
telephoneNo String
|
||||
|
||||
employmentOffice String
|
||||
businessType String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue