Skip to content

fix(query-generator): increment/decrement with scope include/exclude - #11676

Closed
mhio wants to merge 6 commits into
sequelize:masterfrom
mhio:bug/10719
Closed

mhio wants to merge 6 commits into
sequelize:masterfrom
mhio:bug/10719

Conversation

@mhio

@mhio mhio commented Nov 13, 2019 •

Copy link
Copy Markdown

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

Closes #10719

Ignore include/exclude attributes that are included in a scope when running increment/decrement via QueryGenerator.arithmeticQuery

One test was already failing prior to and after testing:

  1. [SQLITE] Transaction
    fails with SQLITE_BUSY when retry.match is changed:
    AssertionError: expected promise to be rejected with an error including 'SQLITE_BUSY: database is locked' but it was fulfilled with [ undefined, undefined ]

Test from @ALiangLiang included - ALiangLiang@be03653 with a small update to make the decrement assert work.

@mhio mhio changed the title Bug/10719 fix(query-generator): increment/decrement with scope include/exclude Nov 13, 2019
@codecov

codecov Bot commented Jan 15, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #11676 into master will increase coverage by 8.5%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #11676     +/-   ##
=========================================
+ Coverage   87.76%   96.26%   +8.5%     
=========================================
  Files          92       94      +2     
  Lines        9095     9192     +97     
=========================================
+ Hits         7982     8849    +867     
+ Misses       1113      343    -770
Impacted Files Coverage Δ
lib/query-interface.js 92.19% <ø> (+0.48%) ⬆️
lib/sequelize.js 95.93% <ø> (+3.75%) ⬆️
lib/model.js 96.54% <100%> (+0.06%) ⬆️
lib/dialects/mssql/query.js 95.53% <100%> (+89.94%) ⬆️
lib/dialects/mssql/connection-manager.js 87.01% <0%> (ø)
lib/dialects/mssql/index.js 100% <0%> (ø)
lib/dialects/abstract/query.js 91.98% <0%> (+0.32%) ⬆️
lib/dialects/abstract/query-generator.js 97.01% <0%> (+1.36%) ⬆️
... and 12 more

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 43e83f5...fd49e4c. Read the comment docs.

@papb

papb commented Jan 15, 2020

Copy link
Copy Markdown
Member

Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future! And sorry to take so long to reply.

Are you still working on this? Looks like the test added by this PR is failing.

@papb papb added P0: critical Only for confirmed, reproduced and extremely relevant bugs. Consider using "P1: important" instead. status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action type: bug DEPRECATED: replace with the "bug" issue type and removed P0: critical Only for confirmed, reproduced and extremely relevant bugs. Consider using "P1: important" instead. labels Jan 15, 2020
@mhio

mhio commented Jan 15, 2020 •

Copy link
Copy Markdown
Author

I thought it was complete as the tests were working locally, except for one random unrelated test. I'll have a look at the CI jobs.

@mhio

mhio commented Jan 16, 2020

Copy link
Copy Markdown
Author

Ah, MSSQL failures. Locally those tests hang at [MSSQL] Configuration Connections problems should fail with a nice message for me so a bit hard to debug.

I think the test data setup is OK as the tests pass for pg and mysql. On the other hand I didn't change any dialect type stuff other than ignoring the include/exclude as field names. Maybe mssql has a different code path for include/exclude handling?

@papb

papb commented Jan 16, 2020

Copy link
Copy Markdown
Member

Actually tests are failing for everything except SQLite, please take another look at the failing checks

@mhio

mhio commented Jan 20, 2020

Copy link
Copy Markdown
Author

I think that's got it, the new test wasn't waiting for one of the test promises so there was some odd timing issues.

btw I get "We couldn't find the repository sequelize/sequelize" when I try to view the travis-ci details.

@papb

papb commented Jan 20, 2020

Copy link
Copy Markdown
Member

btw I get "We couldn't find the repository sequelize/sequelize" when I try to view the travis-ci details.

Really? Like when you go here? Can you paste a screenshot? (in case you don't know, you can just ctrl+v an image directly in the comment box)

@papb

papb commented Jan 20, 2020

Copy link
Copy Markdown
Member

Hi again @mhio, I observed that although your PR does fix the issue as stated in #10719, the bug is more severe than what was mentioned in the issue. When reviewing your PR I observed that not only include/exclude causes a bug, but also simply using attributes: { ['foo', 'bar'] } also doesn't work.

I have found a solution and will open a PR soon.

@papb papb closed this Jan 20, 2020
@papb papb removed the status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action label Jan 20, 2020
@papb papb mentioned this pull request Jan 20, 2020
3 of 6 tasks
@mhio

mhio commented Jan 22, 2020

Copy link
Copy Markdown
Author

Really? Like when you go here? Can you paste a screenshot?

image

@papb

papb commented Jan 22, 2020

Copy link
Copy Markdown
Member

@mhio Thanks for the reply, that is really really odd, @sushantdhiman do you have any idea what could be happening for travis to not show?

@mhio

mhio commented Jan 22, 2020

Copy link
Copy Markdown
Author

Oh sorry, my bad. Don't worry about the travis error. That was just a third party asset that wasn't loading. It was just a weird way for travis to display the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug DEPRECATED: replace with the "bug" issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

increment shows sql error after use scope query

3 participants