-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support custom @id column name in scaffold #8264
Support custom @id column name in scaffold #8264
Conversation
Hey @samthuang thanks for taking this one on, this part of the codebase is a little gnarly so it's super appreciated. I tried it locally and there's still some things to work out. I pushed one commit with a fix here: 45ed22b. This got me a little farther in creating a new user with a custom ID. Here's where I'm at now: It looks like the custom ID is being generated as a required field on the create SDL (in this example, my custom ID's name is input CreateUserExampleInput {
+ myId: Int!
email: String!
name: String
} Update: looks like we have to add the custom ID name to
|
hey @jtoar - sorry for the slow response; I've been on the road for work (actually in SF now). And just to clarify on the next step, we have to somehow find a way to include the custom ID name in that |
@samthuang yep that's right! |
hey hey @jtoar and team - I just want to give a quick update. I've been occupied with other works recently and haven't have the chance to visit this PR, but I still plan to work on this if possible. Hopefully to get some focus time soon! |
sorry it's taking me a while to wrap up the PR. I will have a ready-for-review version by the end of this week : ) |
Hello @jtoar - again, sorry it took a while to prepare the PR for review. Please let me know if this enhancement is still needed. Also, I am unsure why the test is failing : / |
@samthuang Thanks a lot for this PR. This is impressive work! So sorry we lost track of this PR 🙁 I just tried running the tests locally (thanks for writing those!) and I'm seeing some failures Are you still interested in working on this PR? If so, could you try to see why the tests are failing? EDIT: Yeah, I couldn't help myself. I went ahead and fixed the tests and merged the PR 😄 |
@Tobbe, thank you so much for carrying the PR to the end! sorry i have not been active in a while in following up 😅 . just curious, but how did switching to generating TS files resolve the bug?! |
At some point after you created this PR we changed to So I could have just updated the file paths to |
Co-authored-by: Dominic Saadi <[email protected]> Co-authored-by: Tobbe Lundberg <[email protected]>
Ah! Got it, thank you so much for taking the time to explain 😄 really appreciate it. |
An improvement to the scaffold feature (and other generators) allows columns with custom names to serve as the
@id
field in the Prisma data model. The scaffold feature assumes that the@id
field is named "id" by default. This change provides flexibility to specify any name for the@id
column if it is marked with the@id
attribute in the Prisma data model.Changes
@id
column name during code generation.@id
column name in the generated code.@id
column names.resolves #5649