chore: database refactor
This commit is contained in:
parent
7b296ec904
commit
abae279c9f
1 changed files with 125 additions and 15 deletions
|
|
@ -130,12 +130,14 @@ model Province {
|
|||
updatedBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
district District[]
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
employeeCheckup EmployeeCheckup[]
|
||||
district District[]
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
employeeCheckup EmployeeCheckup[]
|
||||
customerBranchCitizen CustomerBranchCitizen[]
|
||||
customerBranchHouseRegis CustomerBranchHouseRegis[]
|
||||
}
|
||||
|
||||
model District {
|
||||
|
|
@ -151,11 +153,13 @@ model District {
|
|||
updatedBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
subDistrict SubDistrict[]
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
subDistrict SubDistrict[]
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
CustomerBranchCitizen CustomerBranchCitizen[]
|
||||
CustomerBranchHouseRegis CustomerBranchHouseRegis[]
|
||||
}
|
||||
|
||||
model SubDistrict {
|
||||
|
|
@ -172,10 +176,12 @@ model SubDistrict {
|
|||
updatedBy String?
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
branch Branch[]
|
||||
user User[]
|
||||
customerBranch CustomerBranch[]
|
||||
employee Employee[]
|
||||
CustomerBranchCitizen CustomerBranchCitizen[]
|
||||
CustomerBranchHouseRegis CustomerBranchHouseRegis[]
|
||||
}
|
||||
|
||||
enum Status {
|
||||
|
|
@ -523,6 +529,110 @@ model CustomerBranch {
|
|||
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 {
|
||||
id String @id @default(cuid())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue