-
Notifications
You must be signed in to change notification settings - Fork 9
Get server-generated ID's of inserted rows #13
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
Comments
I personally never implemented this b/c I would of had to build a custom input type to return multiple rows vs. the already written one from an internal postgraphile plugin I borrowed. You can just use a second query to get them that takes place after the mutation. There is a query field you can use on the returned values for this like as show below (just a guess at your table / query name is):
If you want to update the plugin and add the proper type, I would be more than glad to accept a PR. At some point I may update this, just too busy with other stuff. If there was a sponsor I would consider further. |
Thanks for the quick response! Unfortunately query {
allPartsTransfer {
nodes {
id
}
} returns all PartsTransfers, even ones created before this request...
Fully understand. Can you email me [email protected] with an acceptable hourly rate to work on this task? Thanks! |
Right, but as long as the query is within the mutation you'll get the additional created ids then you could then diff the two sets to get the changed ids. Here's another library I created that somewhat automates that. I do need to update this feature though. If that workaround doesn't work, give me a few days and I'll reach out. |
This is large table so getting all the ids is not performant, so this is not a solution |
@tjmoses Were you able to make progress on this? Or could you point me to where I could make such a change? |
@endurance-chorus so mark had some issues with his PR to resolve this, they were laid out here: If you fix those issues on the PR, I'll be more than happy to merge it. Further if you can give a few manual test scenarios you did, to ensure the code will not break that would also be great. I know setting up the testing suite for this plugin, takes significant time so manual tests are fine with me. Also, bump up the package version number a major number (since this could break other packages). Thanks! |
Uh oh!
There was an error while loading. Please reload this page.
Hey Tim, great looking package here, I especially like the opt-in smart comments design.
I have a query such as
Where I am creating many PartsTransfers rows, and then I would like to get the server-generated ID's back. Currently, it seems to only return 1 id, instead of returning many id's, 1 id for each new row inserted.
Am I missing something or is this just not implemented? And if it's not implemented, how hard do you think it is to implement?
The text was updated successfully, but these errors were encountered: