uncheckedScalarInputs One relationship unchecked
See original GitHub issueBug description
If we have a table which has two or more relationships, we can’t use both the “connect” method and direct id method. Also ‘create’ relationship won’t work on other relationships
How to reproduce
return this.prisma.zone.create({
data: {
facilityId: record.cityId, // direct
city: {
connect: {
id: record.cityId // using connect
},
},
},
});
Create
return this.prisma.zone.create({
data: {
facilityId: record.cityId, // direct
city: {
create: {
name: record.city.name, //create
},
},
},
});
Expected behavior
It should allow both ways for different relationships. Right now with the XOR check its deciding either checked or unchecked input type for the object.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Prisma Client and Prisma schema preview features
When we release a new Prisma Client or Prisma schema feature, it often starts in preview so that you can test it and...
Read more >Prisma 2.11.0 Release - GitClear
We now support writing foreign keys (also known as relation scalars) directly with the uncheckedScalarInputs preview feature.
Read more >Create or update one to many relationship in Prisma
I'm providing my solution based on the clarifications you provided in the comments. First I would make the following changes to your Schema....
Read more >@prisma/cli: Versions | Openbase
Prisma has a set of rules for defining relations between models in the Prisma ... Upsert not creating all entries · uncheckedScalarInputs: XOR...
Read more >asciant/prisma2-unchecked-relations - Issues Antenna
Unchecked inputs don't have access to connect , or set , etc. with some ... In isolation, it would create the 1-1 relation,...
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
Hey @DregondRahl
This is intentional right now. The problem here is if we allow both cases for each foreign key, there will be too many permutations and input generation will blow exponentially. For example with four foreign keys, we will need to generate 2^4=16 input types.
For now you will need to either choose use one of the syntaxes. My recommendation would be to if you fallback to connect method if you need connect via some other field.
Thanks @pantharshit00, closing. We can re-open if that doesn’t work for you @DregondRahl.