ManyToMany join table model generates empty inputs
See original GitHub issueBug description
When I define models with ManyToMany relation and separate join table (it’s happening when introspecting the existing database), Prisma client generates empty inputs for update many operations on that join table model:
How to reproduce
Generate Prisma client from schema below.
Then try to make updateMany
operation - you’re not allowed to pass any keys to data
object:
await prisma.studentClass.updateMany({ data: {}, where: { classId: 1 } });
Expected behavior
When mutation input has no fields, the whole operation should be not available as it makes no sense.
It should be removed from DMMF so other prisma ecosystem tools don’t suffer from this issue.
Prisma information
model Student {
id Int @id @default(autoincrement())
name String
StudentClass StudentClass[]
}
model Class {
id Int @id @default(autoincrement())
name String
StudentClass StudentClass[]
}
model StudentClass {
studentId Int
classId Int
student Student @relation(fields: [studentId], references: [id])
class Class @relation(fields: [classId], references: [id])
@@id([studentId, classId])
}
Environment & setup
- OS: Windows 10 x64 @ WSL2 Ubuntu 20.04
- Database: PostgreSQL
- Node.js version: 14.13
- Prisma version:
@prisma/cli : 2.9.0
@prisma/client : 2.9.0
Current platform : debian-openssl-1.1.x
Query Engine : query-engine 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt 369b3694b7edb869fad14827a33ad3f3f49bbc20 (at node_modules/@prisma/cli/prisma-fmt-debian-openssl-1.1.x)
Studio : 0.296.0
Preview Features : connectOrCreate, atomicNumberOperations
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Empty join table for ManyToMany Relationship - Stack Overflow
I want to see whether you are setting WaterQuality objects in case study or CaseStudy objects in WaterQuality. If You will be adding ......
Read more >The right way to use a ManyToManyField in Django
To maintain a many-to-many relationship between two tables in a database, the only way is to have a third table which has references...
Read more >Creating forms from models - Django documentation
The generated Form class will have a form field for every model field specified, in the order specified ... ManyToManyField is represented by...
Read more >Relate and Unrelate functions in Power Apps - Microsoft Learn
For many-to-many relationships, the system that links the records maintains a hidden join table. You can't access this join table directly; it ...
Read more >Hibernate Many-to-Many Association with Extra Columns in ...
We are going to introduce two different solutions to cope with the additional fields of the join table in the above relationship diagram....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Bump! It’s been a half-year since the last comment 😛 It’s a pretty urgent issue I believe, and the workarounds are hard to achieve. 😞
Folks using
typegraphql-prisma
are running into this quite a lot.Issues: