Repository navigation
feat(core): Drop the ability to specify the dialect as a string - #18204
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughRemoved string-union dialect typing and the runtime string→class dialect resolver; dialects must now be provided as classes. Converted several CommonJS imports to ESM, refactored validator utilities into a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SequelizeCtor as Sequelize.constructor
participant Internals as sequelize.internals
participant DialectClass as DialectClass
rect rgba(200,200,255,0.5)
User->>SequelizeCtor: new Sequelize({ dialect: "postgres" }) (OLD)
SequelizeCtor->>Internals: importDialect("postgres")
Internals->>DialectClass: require dialect package -> return class
SequelizeCtor->>DialectClass: instantiate dialect class
end
rect rgba(200,255,200,0.5)
User->>SequelizeCtor: new Sequelize({ dialect: PostgresDialectClass }) (NEW)
SequelizeCtor->>SequelizeCtor: validate typeof dialect === 'function'
SequelizeCtor->>DialectClass: instantiate dialect class directly
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.17.0)packages/core/test/support.ts┌──────────────┐ �[32m✔�[39m �[1mOpengrep OSS�[0m �[1m Loading rules from local config...�[0m Thanks 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 |
* main: (200 commits) meta: update actions/upload-artifact action to v7.0.1 (sequelize#18212) meta: update sequelize AUTHORS (sequelize#18208) feat(cli): add migration generate, run, status & undo (sequelize#18193) feat(core): Drop the ability to specify the dialect as a string (sequelize#18204) feat: update some dialect adapters (sequelize#18189) feat(postgres): replace pg-hstore with inline hstore parser (sequelize#18151) feat(core): add `sql.random`, improve `Order` typing (sequelize#18203) meta: use Sequelize Bot for drafting PRs (sequelize#18201) meta: automatically mark unfinished PRs as draft (sequelize#18197) meta: update dependency @oclif/test to v4.1.18 (sequelize#18198) fix(core): replace @typeparam with @template in JSDoc (sequelize#18094) feat(core): Add support for UUID v7 (sequelize#17832) meta: update sequelize AUTHORS (sequelize#18190) meta: update dependency @oclif/plugin-help to ^6.2.43 (sequelize#18195) meta: update dependency esbuild to v0.28.0 (sequelize#18192) meta: update dependency @oclif/plugin-help to ^6.2.42 (sequelize#18191) meta: update dependency @oclif/core to ^4.10.5 (sequelize#18187) meta: update sequelize AUTHORS (sequelize#18158) feat: add Node 24 support, drop Node 18 (sequelize#18185) feat(core): add support for readonly attribute arrays (sequelize#18186) ...
Pull Request Checklist
Description of Changes
The goal is to improve the ability to bundle code that uses Sequelize, by not requiring modules that might not be installed.
To do that, I dropped the ability to set the the
dialectSequelize constructor option to a string. Users already need to change their connection options because they depend on the dialect now, so there is no real reason to keep the legacydialectoption. I think it even hurts TypeScript users to keep it, because they don't get proper option typings if they specify a dialect string instead of a dialect class.The CLI still supports dialect strings thanks to this PR: #18193
Note: The ability to bundle Sequelize is still not perfect, as we still dynamically require moment.
List of Breaking Changes
The
dialectoption of theSequelizeconstructor now must be a Dialect class. It cannot be a string anymore, and Sequelize will notrequirethe Dialect class automatically.Summary by CodeRabbit
Refactor
Bug Fixes