feat: relation and auto gen code

This commit is contained in:
Methapon2001 2024-06-11 13:01:20 +07:00
parent af4489dccc
commit f7c916b84a
4 changed files with 91 additions and 23 deletions

View file

@ -570,8 +570,10 @@ model Work {
model WorkProduct {
id String @id @default(uuid())
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
workId String
work Work @relation(fields: [workId], references: [id], onDelete: Cascade)
workId String
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
productId String
createdBy String?
createdAt DateTime @default(now())
@ -590,10 +592,11 @@ model ProductGroup {
status Status @default(CREATED)
createdBy String?
createdAt DateTime @default(now())
createdAt DateTime @default(now())
updateBy String?
updatedAt DateTime @updatedAt
Product Product[]
updatedAt DateTime @updatedAt
type ProductType[]
}
model ProductType {
@ -611,6 +614,9 @@ model ProductType {
updateBy String?
updatedAt DateTime @updatedAt
productGroup ProductGroup @relation(fields: [productGroupId], references: [id], onDelete: Cascade)
productGroupId String
product Product[]
}
@ -630,8 +636,7 @@ model Product {
productType ProductType? @relation(fields: [productTypeId], references: [id], onDelete: SetNull)
productTypeId String?
productGroup ProductGroup? @relation(fields: [productGroupId], references: [id], onDelete: SetNull)
productGroupId String?
workProduct WorkProduct[]
createdBy String?
createdAt DateTime @default(now())