-
Notifications
You must be signed in to change notification settings - Fork 975
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
fix(cli): use field name for relations generation #813
Conversation
Thanks for this @Rosenberg96! Looping in Rob for review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the generated code actually capitalizes the TEST
part of the field names like that? That's definitely not intended!
But everything else looks correct to me...Profile -> pictureTest and Image -> ProfileTest. Wouldn't your code change the relations to Profile -> image and Image -> profiles?
@cannikin Please ignore the In regards to your other comment I am not sure I follow. This does not change the actual relations between the two models. This is the SQLLite migration:
When re-reviewing this change I do run into the issue when a new
I am not too familiar with the web par of the generators, but it is clear that the PS: |
This is a known issue when generating scaffolds with foreign keys. I have an open issue with Prisma about letting us set this field instead of it being read-only. We currently have an SDL test in place that has a relationship name And you can see the text fixture that represents the generated SDL file has the correct type But shouldn't this be incorrect and your PR is what would fix it? Or is it the generated SERVICE names that are incorrect? I'm so confused! 😅 |
@cannikin This PR fixes the generated service files. Your links point to test cases with the SDL's, which are in fact correct and are generated in the same as this now, since it not just uses the I should have left out the generated SDL from the PR description, but the mismatch was in the services <-> SDL before this change. |
Ahhhh that makes more sense, thanks for being patient with me. :) Let's merge it! |
Closes #786
When generating service files, unfortunately it has been missed that one can specify a field name that does not necessarily match the relation name. Tested with the following schema:
schema.prisma
Generated services:
Generated sdl
Edit: Corrected the actual output to be correct after migration of DB.