Open Xoouu opened 1 year ago
Instead of defining the model like this:
module.exports = function(sequelize, DataTypes) { return sequelize.define('User', { // Model attributes are defined here firstName: { type: DataTypes.STRING, allowNull: false }, lastName: { type: DataTypes.STRING // allowNull defaults to true }, } }
Being able to choose to define it with an instance:
module.exports = function(sequelize, DataTypes) { const User = sequelize.define('User', { // Model attributes are defined here firstName: { type: DataTypes.STRING, allowNull: false }, lastName: { type: DataTypes.STRING // allowNull defaults to true } }, { // Other model options go here }); // Hook User.beforeCreate(()=>{ // something }) return User; }
If that is possible to already do, where can I find that information?
Instead of defining the model like this:
Being able to choose to define it with an instance:
If that is possible to already do, where can I find that information?