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: fix #260 UPDATE with LIMIT and ORDER should be formatted(mysql only) #261

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

JimmyDaddy
Copy link
Collaborator

attr

@codecov-commenter
Copy link

Codecov Report

Merging #261 (2238375) into master (3de068c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #261   +/-   ##
=======================================
  Coverage   97.32%   97.33%           
=======================================
  Files          44       44           
  Lines        3144     3155   +11     
=======================================
+ Hits         3060     3071   +11     
  Misses         84       84           
Impacted Files Coverage Δ
src/adapters/sequelize.js 94.87% <100.00%> (+0.03%) ⬆️
src/drivers/abstract/spellbook.js 96.65% <100.00%> (+0.04%) ⬆️
src/drivers/mysql/spellbook.js 96.87% <100.00%> (+0.57%) ⬆️

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 3de068c...2238375. Read the comment docs.

const extraOptions = this.formatUpdateExtraOptions(spell);
if (extraOptions.length) {
chunks.push(...extraOptions);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug fix shouldn't be sequelize adapter specific I think. Use cases like below should be supported as well:

Post.update({ title: null }, { title: 'Untitled' }).order('id', 'desc').limit(10);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug fix shouldn't be sequelize adapter specific I think. Use cases like below should be supported as well:

Post.update({ title: null }, { title: 'Untitled' }).order('id', 'desc').limit(10);

It's a MySQL only feature, this was supported at this PR, see

test/integration/suite/basics.test.js:685
test/unit/spell.test.js:638

@@ -682,6 +682,21 @@ describe('=> Basic', () => {
expect(posts.length).to.equal(affectedRows);
});

it('Bone.update(where, values) should work with limit/offset and order', async function() {
if (Post.driver.type === 'mysql') {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql only

@cyjake cyjake merged commit e20a035 into master Jan 25, 2022
@cyjake cyjake deleted the fix/update_with_limit_offset branch February 17, 2022 07:24
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.

3 participants