refactor: customer create and update process

This commit is contained in:
Methapon Metanipat 2024-08-20 15:41:48 +07:00
parent b167a612b4
commit 5bb8da818c
6 changed files with 261 additions and 462 deletions

View file

@ -0,0 +1,56 @@
/*
Warnings:
- You are about to drop the column `customerName` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `customerNameEN` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `personName` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `personNameEN` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `taxNo` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `branchNo` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `bussinessType` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `bussinessTypeEN` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `name` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `nameEN` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `taxNo` on the `CustomerBranch` table. All the data in the column will be lost.
- You are about to drop the column `zipCode` on the `CustomerBranch` table. All the data in the column will be lost.
- Added the required column `birthDate` to the `Customer` table without a default value. This is not possible if the table is not empty.
- Added the required column `firstName` to the `Customer` table without a default value. This is not possible if the table is not empty.
- Added the required column `gender` to the `Customer` table without a default value. This is not possible if the table is not empty.
- Added the required column `lastName` to the `Customer` table without a default value. This is not possible if the table is not empty.
- Added the required column `businessType` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `businessTypeEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `workplace` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
- Added the required column `workplaceEN` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Customer" DROP COLUMN "customerName",
DROP COLUMN "customerNameEN",
DROP COLUMN "personName",
DROP COLUMN "personNameEN",
DROP COLUMN "taxNo",
ADD COLUMN "birthDate" TIMESTAMP(3) NOT NULL,
ADD COLUMN "firstName" TEXT NOT NULL,
ADD COLUMN "firstNameEN" TEXT,
ADD COLUMN "gender" TEXT NOT NULL,
ADD COLUMN "lastName" TEXT NOT NULL,
ADD COLUMN "lastNameEN" TEXT,
ADD COLUMN "namePrefix" TEXT;
-- AlterTable
ALTER TABLE "CustomerBranch" DROP COLUMN "branchNo",
DROP COLUMN "bussinessType",
DROP COLUMN "bussinessTypeEN",
DROP COLUMN "name",
DROP COLUMN "nameEN",
DROP COLUMN "taxNo",
DROP COLUMN "zipCode",
ADD COLUMN "businessType" TEXT NOT NULL,
ADD COLUMN "businessTypeEN" TEXT NOT NULL,
ADD COLUMN "citizenId" TEXT,
ADD COLUMN "workplace" TEXT NOT NULL,
ADD COLUMN "workplaceEN" TEXT NOT NULL,
ALTER COLUMN "legalPersonNo" DROP NOT NULL,
ALTER COLUMN "registerName" DROP NOT NULL,
ALTER COLUMN "registerDate" DROP NOT NULL,
ALTER COLUMN "authorizedCapital" DROP NOT NULL;

View file

@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "CustomerBranch" ADD COLUMN "legalPersonName" TEXT;

View file

@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `code` on the `Customer` table. All the data in the column will be lost.
- You are about to drop the column `legalPersonName` on the `CustomerBranch` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "Customer" DROP COLUMN "code";
-- AlterTable
ALTER TABLE "CustomerBranch" DROP COLUMN "legalPersonName",
ADD COLUMN "registerNameEN" TEXT;