Following the documentation to generate model and migration at the same time, we can use: npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string
This generates a model file.js with:
User.init({
firstName: DataTypes.STRING,
lastName: DataTypes.STRING,
email: DataTypes.STRING
}
But I want to specify additional condition/properties, like:
User.init({
user_id: {
type: DataTypes.INTEGER,
autoIncrement: true, <====
primaryKey: true, <====
},
firstName: {
type: DataTypes.STRING,
allowNull: false <====
},
lastName: {
type: DataTypes.STRING
}
}
Is there a way for me to specify additional params than just the datatype... like primaryKey, autoIncrement, or allowNull?
There is already a question here, but no working answer.
Thanks in advance