chore: database refactor

This commit is contained in:
Methapon Metanipat 2024-09-17 10:39:22 +07:00
parent 7b296ec904
commit abae279c9f

View file

@ -136,6 +136,8 @@ model Province {
customerBranch CustomerBranch[] customerBranch CustomerBranch[]
employee Employee[] employee Employee[]
employeeCheckup EmployeeCheckup[] employeeCheckup EmployeeCheckup[]
customerBranchCitizen CustomerBranchCitizen[]
customerBranchHouseRegis CustomerBranchHouseRegis[]
} }
model District { model District {
@ -156,6 +158,8 @@ model District {
user User[] user User[]
customerBranch CustomerBranch[] customerBranch CustomerBranch[]
employee Employee[] employee Employee[]
CustomerBranchCitizen CustomerBranchCitizen[]
CustomerBranchHouseRegis CustomerBranchHouseRegis[]
} }
model SubDistrict { model SubDistrict {
@ -176,6 +180,8 @@ model SubDistrict {
user User[] user User[]
customerBranch CustomerBranch[] customerBranch CustomerBranch[]
employee Employee[] employee Employee[]
CustomerBranchCitizen CustomerBranchCitizen[]
CustomerBranchHouseRegis CustomerBranchHouseRegis[]
} }
enum Status { enum Status {
@ -523,6 +529,110 @@ model CustomerBranch {
quotation Quotation[] quotation Quotation[]
} }
model CustomerBranchCitizen {
id String @id @default(cuid())
namePrefix String?
firstName String
firstNameEN String?
middleName String?
middleNameEN String?
lastName String
lastNameEN String?
issueDate DateTime @db.Date
expireDate DateTime @db.Date
nationality String
religion String
gender String
address String?
addressEN String?
soi String?
soiEN String?
moo String?
mooEN String?
street String?
streetEN String?
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
provinceId String?
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
districtId String?
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
subDistrictId String?
}
model CustomerBranchPoa {
id String @id @default(cuid())
}
model CustomerBranchHouseRegis {
id String @id @default(cuid())
registrationOffice String
houseId String
houseNo String
villageNo String
address String?
addressEN String?
soi String?
soiEN String?
moo String?
mooEN String?
street String?
streetEN String?
province Province? @relation(fields: [provinceId], references: [id], onDelete: SetNull)
provinceId String?
district District? @relation(fields: [districtId], references: [id], onDelete: SetNull)
districtId String?
subDistrict SubDistrict? @relation(fields: [subDistrictId], references: [id], onDelete: SetNull)
subDistrictId String?
namePrefix String?
firstName String
firstNameEN String?
middleName String?
middleNameEN String?
lastName String
lastNameEN String?
issueDate DateTime @db.Date
expireDate DateTime @db.Date
nationality String
religion String
gender String
marriageStatus String
citizenId String
birthDate DateTime @db.Date
motherFullName String
motherFullNameEN String?
motherCitizenId String
motherNationality String?
fatherFullName String
fatherFullNameEN String?
fatherCitizenId String
fatherNationality String?
}
enum CommercialType {
CORP
PERS
}
model CustomerBranchCommercialRegis {
id String @id @default(cuid())
registrationNo String
registrationType CommercialType
requestNo String? // NOTE: CORP only
namePrefix String? // NOTE: PERS only
fullName String
fullNameEN String
registrationDate String
romanLetter String?
}
model CustomerBranchVatRegis {
id String @id @default(cuid())
}
model Employee { model Employee {
id String @id @default(cuid()) id String @id @default(cuid())