Repository navigation
fix: use different default schema per dialect, escape quotes in identifiers instead of removing them, normalize Model.getTableName - #15274
Merged
Conversation
ephys
commented
Nov 12, 2022
ephys
commented
Nov 12, 2022
ephys
commented
Nov 12, 2022
ephys
commented
Nov 12, 2022
ephys
commented
Nov 12, 2022
ephys
marked this pull request as ready for review
November 12, 2022 18:35
WikiRik
reviewed
Nov 13, 2022
WikiRik
reviewed
Nov 15, 2022
WikiRik
marked this pull request as draft
November 16, 2022 13:13
Member
|
SQLite unit tests fail since I included a test for the schema, but we've said that sqlite does not support schemas so we'll need to see how to deal with that |
WikiRik
approved these changes
Nov 17, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description Of Change
This PR is yet-another preliminary PR for #14687 in order to prevent that other PR from growing endlessly.
The goal of this PR is to:
AbstractQueryGeneratorTypeScriptand migrate some base QueryGenerator methods to TypeScriptgetDefaultSchema, and rewritingextractTableDetails. We should eventually arrive at a state where all query generator methods default the table schema to either the schema set through Sequelize's options, or the per-dialect default schema.quoteIdentifierwith one very important change:queryGenerator.quoteIdentifier('"abc"')previously unquoted then quoted its input. Quotes are actually valid as identifiers, as long as they're escaped. Instead of returning"abc", this method will now return"""abc"""(triple " because one is the actual identifier delimiter, and two consecutive""is how we escape").addTicks,removeTicks, andTICK_CHAR,wrapSingleQuotefor the above reasonBecause
quoteIdentifierdoesn't remove existing quotes anymore, I had to tweak parts of queryGenerator. Functions likeselectQuerypassed its identifiers toquoteIdentifiermultiple times. Causing duplicate quotes.My current plan for
AbstractQueryGeneratorTypeScriptis to only move APIs once they are considered stable & suitable for public use.