Skip to content

Support INSERT... ON CONFLICT for upserts in v3 - #7174

Closed
cuongdo wants to merge 1 commit into
sequelize:v3from
cuongdo:insert_on_conflict
Closed

cuongdo wants to merge 1 commit into
sequelize:v3from
cuongdo:insert_on_conflict

Conversation

@cuongdo

@cuongdo cuongdo commented Jan 31, 2017 •

Copy link
Copy Markdown

Resolves #4132

Heavily inspired by #6325

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does your issue contain a link to existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Have you added an entry under Future in the changelog?

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

This change adds the small extensions options.conflict.target and options.conflict.constraint to Model.upsert to support using PostgreSQL 9.5's INSERT... ON CONFLICT feature. This replaces the stored procedure that's currently used. If Postgres >= 9.5 is used and no options.conflict.* options are specified, the primary key column(s) are implicitly used as the conflict target. If Sequelize is used with PostgreSQL prior to 9.5, we still use the existing stored procedure.


This change is Reviewable

@mention-bot

Copy link
Copy Markdown

@cuongdo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @BridgeAR, @nunofgs and @janmeier to be potential reviewers.

@cuongdo

cuongdo commented Feb 6, 2017

Copy link
Copy Markdown
Author

Could I please have some feedback?

I've also noticed that the code coverage checks are failing, and it seems that the new code isn't being triggered. Is the code coverage being measured against PostgreSQL 9.5?

@cuongdo

cuongdo commented Feb 16, 2017

Copy link
Copy Markdown
Author

friendly ping

@lironess

Copy link
Copy Markdown

Can I help somehow?
I really need that feature

@sushantdhiman

Copy link
Copy Markdown
Contributor

v4 has been released and we have decided v3 will only accept critical bug fixes and security updates, no more features will be added to v3

Although we will review and merge its master verrsion #6325 soon

@tsheaff tsheaff mentioned this pull request Apr 4, 2019
2 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants