To auto generate migrations with Node.js Sequelize CLI from Sequelize models, we run sequelize model:create
.
For instance, we run
sequelize model:create --name MyUser --attributes first_name:string,last_name:string,bio:text
to create the MyUser
model with the first_name
, last_name
, and bio
fields.
Then a migration file will be created along with the model file.