Repository navigation
feat(postgres, sqlite): add conflictWhere option to upsert - #13411
Conversation
df4c9ff to
ee6e62b
Compare
|
Update on this: I ended up implementing this in a fork, but IIRC there was an issue I had w/ it (I believe it was around the logic upsert uses to determine which conflict columns to use, which isn't in the scope of this PR). I want to verify that it wasn't an issue with this change itself before I merge it. |
d701ed0 to
d59c8c4
Compare
|
@allawesome497 What shall we do with this one? |
I'll need to resolve merge conflicts, but it should be fine. Now that #13723 is merged I think I'll also add a few more tests which test the combined behavi for some more specific use cases. |
Waiting for reviewers atm; just bumped it in the sequelize slack. |
ephys
left a comment
There was a problem hiding this comment.
I still think we need to do a thorough clean up of the different options upsert accepts but this is good
|
@ephys re-requesting review - had to patch for compatibility with main which dismissed your approval. |
Co-authored-by: Rik Smale <[email protected]>
|
@WikiRik can you approve this again? the rebase dismissed it. |
Adds an option to set the where clause in the `ON CONFLICT` part of postgres/sqlite upserts. Backport of #13411.
|
conflictWhere not working if I use model column name instead of table column name. |
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
conflictWheretoQueryGenerator.prototype.insertQuery. This is used to generate theON CONFLICT WHEREpart of the query (note: notON CONFLICT DO UPDATE WHERE).Model.upsert,conflictWhere, This is passed to the query generator.Example use case:
Closes #13412.
TODO:
Add some tests which validate
conflictWhere&conflictFieldswork together properly.