New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query engine fails for querying implicit back relation #323
Comments
I can confirm this. |
Here's a reproduction repo with SQLite: https://github.com/madebysid/prisma2-implicit-relations |
For this query:
We get this error: |
I can't reproduce this on latest |
@mavilein Based on our discussion, I'll clarify behaviour here as well. Quoting https://github.com/prisma/specs/tree/master/prisma-schema-language#one-to-one-11-relationships (visit link for context)
Following the spec above, in the original schema, an implicit field called I believe the confusion comes from the difference in behaviour between Prisma 2 and Prisma 1. Implicit relations in Prisma 2 are treated as 1:1 relations. This is different from Prisma 1, where these implicit relations were treated as 1:N. So this example behaves as expected. In order to achieve what @mikeslade expects (the same behaviour as Prisma 1), the resolution he provided (adding a new field to I'm closing this as this is all expected behaviour. Hope this makes it clear @mikeslade. Please feel free to let me know if something I've said is unclear! |
Originally pointed out by @mikeslade on #114 (comment)
I set up fresh docker environments running ubuntu:latest and postgres:latest instances. Installed prisma2@2.0.0-alpha.87, binary version: 2ada5347b0000b7fe5171e41a4bec5b3d11c61e3
Here is the datamodel:
here is the seed:
Running prisma2 dev after migrating and seeding the db results in the following error:
Interestingly, it doesn't seem to have recognized that there is a 1:n relationship between Users and Groups/Employees.
If I change the datamodel to the following, then it works without error
The text was updated successfully, but these errors were encountered: