Ant Somers
07/21/2022, 4:37 PMcompanyId
of @@id([jobId, productId, companyId])
/// Intermediary between Job and Product
model Freight {
tonnage Float?
amount Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade)
jobId String
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
productId String
reciever Company? @relation(fields: [companyId], references: [id], onDelete: Cascade)
companyId String
pieces Piece[]
@@id([jobId, productId, companyId])
}
model Piece {
id String @id @default(cuid())
number Int
time DateTime @default(now())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
freight Freight @relation(fields: [freightJobId, freightProductId, freightCompanyId], references: [jobId, productId, companyId], onDelete: Cascade)
freightJobId String
freightProductId String
freightCompanyId String
damages PieceDamage[]
}
Austin
07/21/2022, 6:46 PMVladi Stevanovic