Hi building a home application. We have Home mode...
# orm-help
a
Hi building a home application. We have Home model { id name String } and Facility { id name String } The facilities are fixed and will be unversal for all homes. Example Pool, Kithcen, Shower etc. The homes can have none or all of the facilites. How should this many to many relationship be setup?
n
Hey Alfred 👋 Here’s how you could model implicit many to many relations between Home and Facilities
Copy code
model Home {
  id         Int        @id @default(autoincrement())
  name       String
  facilities Facility[]
}

model Facility {
  id   Int    @id @default(autoincrement())
  name String
  Home Home[]
}
Here’s a reference to Many to Many relations