-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: support upserting tables with only unique constraint(s) #680
Conversation
Githib should show ya the contributing.md, but a link would be nice too. Feel free to add those patches inline here. https://github.com/cdaringe/postgraphile-upsert/blob/main/.github/contributing.md missing is the call fir need of docker for integration tests to run |
Ah! Thank you for the link. I hadn't thought to look in the .github folder. I don't recall being prompted when opening the PR but maybe missed it |
Okay, I got tests running and passing locally now |
Thanks! |
Ah crap i meant to release it as a breaking change |
🎉 This PR is included in version 3.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
There isn't really a way to pass config options to v4 plugins is there? To have this feature there but off by default. |
No big deal :) thx for the patches! |
Problem
Upsert mutations are not created for tables without primary keys, even if they have at least one unique constraint. This is inconsistent with Postgraphile core, which generates update mutations for tables with just unique constraints.
Proposed Solution
This updates logic to check for primary key OR at least one unique constraint on the table.
Testing
I have extended an existing test case but have not run the test suite yet (a Contributing section in readme would be a nice addition 🙂).
I have verified behavior experimentally by
yarn link
ing the local clone to an application codebase.