Advanced Sequelize options for defining models
When defining a model, within Sequelize, the last input parameter for the init()
and define()
methods offers us a way to fine-tune our project’s requirements and Sequelize’s behavior. These parameter options are useful for situations such as when we need to construct Sequelize in a pre-existing environment that does not adhere to Sequelize’s naming conventions (for example, a column named PersonIsMIA
as opposed to Sequelize’s "PersonIsMia"
convention).
sequelize
A copy (or new) instance of Sequelize to associate with the model. Sequelize will return an error if this field is not provided (except when using the sequelize.define
method). Useful for querying across data centers or even databases.
modelName
Explicitly defines the model’s name with a string. This would be the first parameter in Sequelize’s define()
method. If you are using ES6 class definitions, the default for...