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 type of methods in query-interface #11582

Merged

Conversation

2kindsofcs
Copy link
Contributor

@2kindsofcs 2kindsofcs commented Oct 19, 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)?
    (npm run test-typings, actaully)
  • 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

as described in #11027, many of the QueryInterface methods accept something like string | { tableName: string, schema: string } as the first argument. however, they are accepting tableName with string type only. So I added interface and type so that they could get arguments other than string.

@papb
Copy link
Member

@papb papb commented Oct 19, 2019

Hi, thanks for the PR, can you please add more tests?

@@ -120,6 +120,15 @@ export interface QueryInterfaceDropAllTablesOptions extends QueryInterfaceOption
skip?: string[];
}

export interface TablenameWithSchema {
Copy link
Member

@SimonSchick SimonSchick Oct 19, 2019

Choose a reason for hiding this comment

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

Should probably be TableName.

Copy link
Contributor Author

@2kindsofcs 2kindsofcs Oct 20, 2019

Choose a reason for hiding this comment

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

Do you mean it should be TableName or TableNameWithSchema?

Copy link
Member

@papb papb Oct 21, 2019

Choose a reason for hiding this comment

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

He probably means TableNameWithSchema

@codecov
Copy link

@codecov codecov bot commented Oct 20, 2019

Codecov Report

Merging #11582 into master will decrease coverage by 3.79%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #11582     +/-   ##
=========================================
- Coverage   96.26%   92.47%   -3.8%     
=========================================
  Files          94       91      -3     
  Lines        9190     8903    -287     
=========================================
- Hits         8847     8233    -614     
- Misses        343      670    +327
Impacted Files Coverage Δ
lib/dialects/sqlite/query-generator.js 2.91% <0%> (-93.69%) ⬇️
lib/dialects/sqlite/query-interface.js 15.62% <0%> (-84.38%) ⬇️
lib/dialects/sqlite/data-types.js 35.89% <0%> (-64.11%) ⬇️
lib/errors/database/timeout-error.js 40% <0%> (-60%) ⬇️
lib/query-interface.js 88.78% <0%> (-3.42%) ⬇️
lib/transaction.js 97.33% <0%> (-2.67%) ⬇️
lib/sequelize.js 94.68% <0%> (-1.25%) ⬇️
lib/dialects/abstract/query.js 91.02% <0%> (-0.97%) ⬇️
lib/dialects/abstract/query-generator.js 96.5% <0%> (-0.52%) ⬇️
lib/data-types.js 91% <0%> (-0.35%) ⬇️
... and 3 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 edac3e9...22d6a62. Read the comment docs.

@2kindsofcs 2kindsofcs force-pushed the fix_type_of_query_interface branch from 5e3c533 to e72dc36 Compare Oct 20, 2019
@2kindsofcs
Copy link
Contributor Author

@2kindsofcs 2kindsofcs commented Oct 20, 2019

@papb hi. I added some tests. I was wondering if you think there should be more tests.

as?: string;
name?: string;
}
export type Tablename = string | TablenameWithSchema;
Copy link
Member

@papb papb Oct 21, 2019

Choose a reason for hiding this comment

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

Suggested change
export type Tablename = string | TablenameWithSchema;
export type TableName = string | TableNameWithSchema;

@papb
Copy link
Member

@papb papb commented Oct 21, 2019

@2kindsofcs Thanks, I think those tests are enough now.

@papb papb added status: awaiting response type: typescript labels Oct 21, 2019
papb
papb approved these changes Oct 22, 2019
@papb papb added status: awaiting maintainer and removed status: awaiting response labels Oct 22, 2019
@sushantdhiman sushantdhiman merged commit c77c553 into sequelize:master Oct 24, 2019
3 of 4 checks passed
@papb papb removed the status: awaiting maintainer label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants