Skip to content
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

fix(mssql): upsert query with falsey values #12453

Merged
merged 9 commits into from Jul 3, 2020

Conversation

patrickcarnahan
Copy link
Contributor

@patrickcarnahan patrickcarnahan commented Jul 2, 2020

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 the description below contain a link to an 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)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

properly determines if a value used in a filter clause for upsert is relevant. currently there is a bug where it treats "falsey" values as not being specified, making it impossible to use something like a default value of 0 in a unique key and then filter by that value.

closes #11902
closes #11684

@patrickcarnahan patrickcarnahan changed the title fix upsert query to work with falsey values fix(mssql): upsert query with falsey values Jul 2, 2020
@codecov
Copy link

codecov bot commented Jul 2, 2020

Codecov Report

Merging #12453 into master will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12453      +/-   ##
==========================================
+ Coverage   96.44%   96.46%   +0.02%     
==========================================
  Files          95       95              
  Lines        9192     9192              
==========================================
+ Hits         8865     8867       +2     
+ Misses        327      325       -2     
Impacted Files Coverage Δ
src/dialects/mssql/query-generator.js 95.69% <100.00%> (ø)
src/dialects/postgres/connection-manager.js 95.80% <0.00%> (+1.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 188a823...ddf2151. Read the comment docs.

@patrickcarnahan
Copy link
Contributor Author

appears that the postgres tests failed even though they should not be impacted by these changes.

@sushantdhiman sushantdhiman merged commit 8281de9 into sequelize:master Jul 3, 2020
@sushantdhiman
Copy link
Contributor

You can open this PR for v6 branch if you want this released to npm

@patrickcarnahan
Copy link
Contributor Author

patrickcarnahan commented Jul 3, 2020

@sushantdhiman thanks! The project that needs this fix is currently on v5. Would it be accepted there as well or is v6 the preferred target? I can open both if that works.

@sushantdhiman
Copy link
Contributor

@patrickcarnahan I would like to avoid pushing too many releases for v5 but bug fixes are allowed. I have merged PR for v6, please open a PR for v5 if your project needs it.

@srikanth2042
Copy link

@patrickcarnahan @sushantdhiman this bug exists in v4 as well, can we expect a bug fix in v4 as well?

@sushantdhiman
Copy link
Contributor

@srikanth2042 No, v4 has been deprecated and not safe to use in production

patrickcarnahan added a commit to patrickcarnahan/sequelize that referenced this pull request Jul 13, 2020
patrickcarnahan added a commit to patrickcarnahan/sequelize that referenced this pull request Jul 14, 2020
patrickcarnahan added a commit to patrickcarnahan/sequelize that referenced this pull request Jul 14, 2020
patrickcarnahan added a commit to patrickcarnahan/sequelize that referenced this pull request Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants