Hello. I have explicit m2m as below. Is there a wa...
# orm-help
a
Hello. I have explicit m2m as below. Is there a way to make
companyId
of
@@id([jobId, productId, companyId])
Copy code
/// 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[]
}
👀 1
a
Hey there! Could you elaborate more on your question?
v
👋 Hey @Ant Somers, did you perhaps have a chance to check Austin's request? Let us know if you can share more about your question!