Alternatively, using sequelize.define
:
The above code tells Sequelize to expect a table named users
in the database with the fields firstName
and lastName
. The table name is automatically pluralized by default (a library called is used under the hood to do this). This behavior can be stopped for a specific model by using the option, or for all models by using the define
option from the Sequelize constructor.
The Sequelize constructor takes a define
option which will change the default options for all defined models.