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(sqlite): quote table names in sqlite getForeignKeysQuery #13587

Merged
merged 1 commit into from Oct 25, 2021

Conversation

steveschmitt
Copy link
Contributor

This PR replaces #12752, which is obsolete.

Table names were not quoted in getForeignKeysQuery that was called by queryInterface.describeTable for the sqlite dialect.

I discovered this defect when I had a sqlite table named "Order" while working on sequelize-auto

This PR fixes it, using the same quoteTable function used elsewhere.

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?
  • (N/A) Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • (N/A) Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

In dialects/sqlite/query-generator.ts, fix getForeignKeysQuery so that it quotes the table names in the same manner that is done in other methods.

Before:

Executing (default): PRAGMA foreign_key_list(Order)

After:

Executing (default): PRAGMA foreign_key_list(`Order`)

@fzn0x
Copy link
Member

fzn0x commented Oct 25, 2021

Nice work! 🐱

LGTM. 🐈

@fzn0x fzn0x merged commit eeb6a8f into sequelize:main Oct 25, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2021

🎉 This PR is included in version 6.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

aliatsis pushed a commit to creditiq/sequelize that referenced this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

addConstraint for compound primary key fails during foreign key check for queryInterface using sqlite dialect
2 participants