feat: customer branch citizen

This commit is contained in:
Methapon Metanipat 2024-09-17 10:57:42 +07:00
parent b12babdc09
commit a0168ee4fb
4 changed files with 254 additions and 0 deletions

View file

@ -0,0 +1,39 @@
/*
Warnings:
- Added the required column `customerBranchId` to the `CustomerBranchCitizen` table without a default value. This is not possible if the table is not empty.
- Added the required column `customerBranchId` to the `CustomerBranchCommercialRegis` table without a default value. This is not possible if the table is not empty.
- Added the required column `customerBranchId` to the `CustomerBranchHouseRegis` table without a default value. This is not possible if the table is not empty.
- Added the required column `customerBranchId` to the `CustomerBranchPoa` table without a default value. This is not possible if the table is not empty.
- Added the required column `customerBranchId` to the `CustomerBranchVatRegis` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "CustomerBranchCitizen" ADD COLUMN "customerBranchId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "CustomerBranchCommercialRegis" ADD COLUMN "customerBranchId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "CustomerBranchHouseRegis" ADD COLUMN "customerBranchId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "CustomerBranchPoa" ADD COLUMN "customerBranchId" TEXT NOT NULL;
-- AlterTable
ALTER TABLE "CustomerBranchVatRegis" ADD COLUMN "customerBranchId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "CustomerBranchCitizen" ADD CONSTRAINT "CustomerBranchCitizen_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchPoa" ADD CONSTRAINT "CustomerBranchPoa_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchHouseRegis" ADD CONSTRAINT "CustomerBranchHouseRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchCommercialRegis" ADD CONSTRAINT "CustomerBranchCommercialRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "CustomerBranchVatRegis" ADD CONSTRAINT "CustomerBranchVatRegis_customerBranchId_fkey" FOREIGN KEY ("customerBranchId") REFERENCES "CustomerBranch"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View file

@ -527,6 +527,12 @@ model CustomerBranch {
employee Employee[]
quotation Quotation[]
citizen CustomerBranchCitizen[]
poa CustomerBranchPoa[]
houseRegis CustomerBranchHouseRegis[]
commercialRegis CustomerBranchCommercialRegis[]
vatRegis CustomerBranchVatRegis[]
}
model CustomerBranchCitizen {
@ -560,12 +566,18 @@ model CustomerBranchCitizen {
subDistrictId String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
}
model CustomerBranchPoa {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
}
model CustomerBranchHouseRegis {
@ -616,6 +628,9 @@ model CustomerBranchHouseRegis {
fatherNationality String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
}
enum CommercialType {
@ -635,12 +650,18 @@ model CustomerBranchCommercialRegis {
romanLetter String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
}
model CustomerBranchVatRegis {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
customerBranchId String
customerBranch CustomerBranch @relation(fields: [customerBranchId], references: [id])
}
model Employee {