-
Notifications
You must be signed in to change notification settings - Fork 44
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
prisma.exists throws an error #252
Comments
Hey @guatedude2 👋, I believe this is hardcoded in light of the current Prisma
I hope this helps 🙂 |
Closing in favour of #275 |
Describe the bug
When calling prisma.exists on a type which is using "key" as the ID, prisma throws an Error.
To Reproduce
Steps to reproduce the behavior:
prisma.exists.I18String({ key: "123" })
Expected behavior
Returns true or false
Versions (please complete the following information):
OS X Mohave
prisma
CLI:prisma/1.20.0 (darwin-x64) node-v10.4.0
1.20.0
prisma-binding
,apollo-server
,ts-node
,typescript
Additional context
Doing my own investigation, seems like the issue is inside
info.ts
wherebuildExistsInfo
, returns only a selection onid
, which is hard-coded rather than what the model considers a primary key. In the case ofI18String
key
is the ID but there is no unique primary key so it returnsundefined
andundefined.length
throws the error.I chose
key
as a non unique key because the key exists for each language (unique key + language) and I don't want prisma generating theid
for me. So, I usekey
as the unique identifier where I set it to a human readable string e.g. "my-unique-key".The text was updated successfully, but these errors were encountered: