Repository navigation
feat!: lock down registered Sequelize models - #17077
Merged
Merged
Conversation
3 of 6 tasks
3 of 8 tasks
WikiRik
approved these changes
Feb 11, 2024
WikiRik
left a comment
Member
There was a problem hiding this comment.
Nice that we're getting closer to re-init a model.
The updates to the tests are also nice. I think after these it should be easier to migrate test suites to TypeScript but that's for future PRs.
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.
Pull Request Checklist
Description Of Change
Closes #16483
The goal of this PR is to:
sequelize.modelswithsequelize.modelManager.modelsto have a single source of truthSetViewsequelize.modelssequelize.isDefined, usesequelize.models.hasorsequelize.models.hasByName. Instead ofsequelize.model, usesequelize.models.getorsequelize.models.getOrThrowmodel.jsthat has not yet been migrated toModelDefinition.Misc details:
sequelize.connectionManageris now a getter instead of a copy ofsequelize.dialect.connectionManagersequelize.getDialect: It returns the dialect name, butsequelize.dialectis the dialect class. This is confusing and users should usesequelize.dialect.nameif they want the name.sequelize.getQueryInterfacein favor ofsequelize.queryInterfaceto unify methods againBreaking changes
Model.init,sequelize.defineandsequelize.addModelscan add models to that set. Onlysequelize.removeAllModelscan remove a model from that set.sequelize.modelManagerwas removed in favor ofsequelize.modelssequelize.modelsis not a plain object anymore, but a Set View with extra methods for model search that previously were available onsequelize.modelManager.TODO