Mordechai Tzarfati
07/25/2022, 9:47 PMLloyd Richards
07/26/2022, 6:49 AMmodel Product {
id Int
title String
creator User <- One to Many
creator_id Int
users UsersOfProduct[] <- Many to Many
}
model User {
id Int
name String
owned_products UsersOfProduct[] <- Many to Many
created_products Product[] <- One to Many
}
model UsersOfProduct {
product Product
product_id Int
user User
user_id Int
@@id([product_id, user_id])
}
Theres a whole article on this at prisma.io
https://www.prisma.io/docs/concepts/components/prisma-schema/relations/many-to-many-relations