'How to implement multi-field in PRISMA? 1 to 1 and the other is 1 to many

Having problem with relationship in PRISMA. I have two tables:

  1. user
  2. customer and this is my relationship
  3. 1 to 1
  4. 1 to many

table user and customer

model User {
  id                     String                   @id @default(cuid())
  firstName              String
  lastName               String
  Customeraccount        Customer?               @relation("useraccount")
  Customer               Customer[]                @relation("user")
}
model Customer {
  id               String               @id @default(cuid())
  firstName        String
  lastName         String
  user             User?           @relation("user",fields: [userId], references: [id])
  userId           String
  useraccount      User?       @relation("useraccount", fields: [useraccountId], references: [id])
  useraccountId    String
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source