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(types): allow specifying additional options for db.query and add missing retry #10512

Merged
merged 1 commit into from Mar 8, 2019

Conversation

2 participants
@SimonSchick
Copy link
Contributor

SimonSchick commented Mar 6, 2019

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 follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

See title
fixes #10506

@sushantdhiman can you clarify if you can specify BOTH the query type AND model?
It seems that when model is specified it implicitly uses SELECT but what if type is specified?

@sushantdhiman

This comment has been minimized.

Copy link
Member

sushantdhiman commented Mar 8, 2019

sequelize/lib/sequelize.js

Lines 482 to 488 in 45648dd

if (!options.type) {
if (options.model || options.nest || options.plain) {
options.type = QueryTypes.SELECT;
} else {
options.type = QueryTypes.RAW;
}
}

Both type and model can be specified, when there is no type we use options.model to set it to SELECT type.

@sushantdhiman

This comment has been minimized.

Copy link
Member

sushantdhiman commented Mar 8, 2019

Let me know if this is ready

@SimonSchick

This comment has been minimized.

Copy link
Contributor Author

SimonSchick commented Mar 8, 2019

@sushantdhiman what exactly is the return type if, for example model and type: INSERT is specified?

@sushantdhiman

This comment has been minimized.

Copy link
Member

sushantdhiman commented Mar 8, 2019

type: INSERT, as model won't modify type if it's already set

@SimonSchick

This comment has been minimized.

Copy link
Contributor Author

SimonSchick commented Mar 8, 2019

So does setting model have any effect for any type except SELECT? Sorry the code is really hard to understand..

@sushantdhiman

This comment has been minimized.

Copy link
Member

sushantdhiman commented Mar 8, 2019

Setting model has no effect on type, if type is already set

@SimonSchick

This comment has been minimized.

Copy link
Contributor Author

SimonSchick commented Mar 8, 2019

So, in typings we should probably not support setting both at the same time then as it's pointless and probably an error.

In this case this PR is complete.

@sushantdhiman sushantdhiman merged commit 0b5aa71 into sequelize:master Mar 8, 2019

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@SimonSchick SimonSchick deleted the SimonSchick:fix/types-query-model branch Mar 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.