Skip to content
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

Add disclaimer regarding usage of direct foreign key values #5683

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

igorrocha
Copy link

@igorrocha igorrocha commented Feb 27, 2024

Describe this PR

The examples section of the connect nested query page currently indicates that you can set foreign keys directly.

However, when you try to use both the direct way of setting a foreign key and the connect query, you get a type error, due to the fact that it is unpractical to generate types for every combination of inputs using direct assignment and connect, as described in this issue comment.

Since this behavior is intentional, and the error you get when trying to combine both approaches isn't very clear, I realized a note on the documentation could prevent some people stumbling on this problem.

Changes

Added a short disclaimer explaining that you can only use one of the two approaches in the same query (the sentence after the code example).

image

What issue does this fix?

Not applicable.

Any other relevant information

I decided to link the main repository's relevant issue to the docs rather than explaining the reasoning behind the limitation, because I figured the disclaimer would get too long otherwise. Please feel free to improve on the disclaimer in case it isn't optimal as is.

Copy link

vercel bot commented Feb 27, 2024

@igorrocha is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@@ -2875,6 +2875,8 @@ const user = await prisma.profile.create({
})
```

However, you can't use both the direct approach and the `connect` approach in the same query. See [this issue comment](https://github.com/prisma/prisma/issues/4322#issuecomment-737976117) for details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Internal note to my colleagues: Can we move the actual information into this sentence to avoid linking to an old issue? The statement from Harshit is still true as far as I know - but might be wort double checking to expand on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants