Skip to content

Conversation

@oversio
Copy link
Contributor

@oversio oversio commented May 17, 2020

(#10472)

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

It is a small fix for the mssql dialect when using the FETCH and OFFSET clauses since these must be used together with the ORDER BY clause and when sending an options.order like a empty array, the ORDER BY clause is not applyed and throw the error

@codecov
Copy link

codecov bot commented May 17, 2020

Codecov Report

Merging #12261 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12261      +/-   ##
==========================================
- Coverage   96.36%   96.33%   -0.03%     
==========================================
  Files          95       95              
  Lines        9125     9125              
==========================================
- Hits         8793     8791       -2     
- Misses        332      334       +2     
Impacted Files Coverage Δ
lib/dialects/mssql/query-generator.js 95.69% <100.00%> (ø)
lib/dialects/postgres/connection-manager.js 94.40% <0.00%> (-1.40%) ⬇️

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 8a1429d...67a70d7. Read the comment docs.

@sushantdhiman
Copy link
Contributor

LGTM, please add a unit test here

Something like

   testsql({
      limit: 10,
      order: [],
      model: { primaryKeyField: 'id', name: 'tableRef' }
    }, {
      default: ' LIMIT 10',
      mssql: ' ORDER BY [tableRef].[id] OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'
    });

@rap2hpoutre
Copy link

Hi @sushantdhiman! It seems it has been released in v6 (not v5). Since it's a fix do you plan to release it in v5 too?

@ikarusnc
Copy link

Is it possible to fix it also for Sequelize V5? Thank you

@oversio
Copy link
Contributor Author

oversio commented Sep 16, 2020

Is it possible to fix it also for Sequelize V5? Thank you

Yes! I can do it in a few days

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