Repository navigation
meta: unify attributeToSQL and attributesToSQL test suites - #18366
Closed
wikirik-agent wants to merge 1 commit into
Closed
wikirik-agent wants to merge 1 commit into
wikirik-agent wants to merge 1 commit into
Conversation
Replaces the per-dialect `attributesToSQL` suites with two dialect-agnostic suites that cover all nine dialects, including ibmi and mssql which had no coverage at all. The expectations pin current behaviour exactly, so this commit changes no SQL. Behaviour that is wrong today is pinned as-is and marked with a TODO. `sqlite3` gains an `attributeToSQL` method, extracted from `attributesToSQL` without changing its output, so the shared suite can cover it like every other dialect. `inlineErrorCause` now inspects non-error values instead of stringifying them: mssql and ibmi return null-prototype maps from `attributesToSQL`, which threw when the assertion message was built. Closes sequelize#15533 Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Sep 11, 2026
Contributor
Author
|
Superseded by #18399. Now that the agent account can push to this repo, the same commits have been reopened from |
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 Changes
First of a stack re-implementing #17121, which is incomplete and has drifted ~11 months behind
main(oracle did not exist when it was last touched).This PR does the test consolidation only. It replaces the per-dialect
attributesToSQLsuites intest/unit/dialects/*/query-generator.test.jswith two dialect-agnostic suites intest/unit/query-generator/, covering all nine dialects — including ibmi and mssql, which had noattributesToSQLcoverage at all.The expectations pin current behaviour exactly. No SQL changes. Behaviour that is wrong today is pinned as-is and marked with a
TODO, so the follow-up PR's diff reads as a list of behaviour deltas rather than a rewrite.Two supporting changes were needed:
sqlite3gains anattributeToSQLmethod, extracted fromattributesToSQLwithout changing its output (including the existingPRIMARY KEY AUTOINCREMENTordering and the non-object passthrough branch). Every other dialect already has one; without it sqlite3 could not join the shared suite.inlineErrorCauseinspects non-error values instead of stringifying them. mssql and ibmi return null-prototype maps fromattributesToSQL, andexpectPerDialectbuilds its assertion message eagerly —String(nullPrototypeObject)throwsCannot convert object to primitive value. This is load-bearing, not cosmetic.Closes #15533
What the new suites found
Expectations were generated from actual output across all nine dialects rather than written by hand, which surfaced a number of problems beyond the ones already flagged on #17121. All are pinned and TODO-marked here, and are the subject of the next PR:
attribute.type._binaryno longer exists on v7 data types, so the "this type cannot have a default" guard is dead on six dialects.attribute.type !== 'TEXT', comparing aDataTypeinstance to a string — it never matches.options.table; mysql/mariadb/snowflake/db2/ibmi readoptions.tableName. Passing the documented option name either throws (mariadb,mysql) or names the constraintundefined_..._foreign_idx(snowflake,db2,ibmi)."myTable_""myColumn""_foreign_idx"); db2 leaves the constraint name unquoted entirely.withoutForeignKeyConstraints.options.schema/options.table/options.withoutForeignKeyConstraintsunguarded, soattributeToSQL(attr)throws whenever the attribute hasreferences.COMMENT ON COLUMNcolumn name fromoptions.key, whichaddColumnQuerysupplies butattributesToSQLdoes not.unique.{ id: 'INTEGER' }), which the other seven dialects accept.Follow-up PRs
AttributeToSqlOptions(table: TableOrModel, addforeignKey, dropschema)attributeToSql/attributesToSqlList of Breaking Changes
None.
🤖 Generated with Claude Code