-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: implicit m:nimplicit many-to-many relationsimplicit many-to-many relationstopic: m:nmany-to-many relationsmany-to-many relationstopic: views
Milestone
Description
If a view
(preview feature) is part of a many-to-many relation, no relation tables are generated.
Let's assume this example:
I have a view "DepartmentInfo" as well as model "User". The user can be part of many departments and a department can have many users -- we are talking about n:m relation.
I defined the view as well as the model in my schema, but prisma doesn't seem to create the relation tables (_User_DepartmentInfo) for that relation. As soon as I change the view to a model, the table is generated.
I have no idea how Prisma is storing the relations or if I am doing it wrong, but this is my observation and i think this is not intended.
// this schema adds relation tables
model User {
id Int @id
departments Department[]
}
model Department {
id Int @id
users User[]
}
// this schema DOES NOT add relation tables
model User {
id Int @id
departments Department[]
}
view Department {
id Int @id
users User[]
}
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.Bug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.A reported bug.topic: implicit m:nimplicit many-to-many relationsimplicit many-to-many relationstopic: m:nmany-to-many relationsmany-to-many relationstopic: views