How to auto generate migrations with Sequelize CLI from Sequelize models?

Sometimes, we want to auto generate migrations with Sequelize CLI from Sequelize models

In this article, we’ll look at how to auto generate migrations with Sequelize CLI from Sequelize models.

How to auto generate migrations with Sequelize CLI from Sequelize models?

To auto generate migrations with Sequelize CLI from Sequelize models, we can run sequelize migration:generate.

For instance, we run

sequelize migration:generate --name [name_of_migration]

to run sequelize migration:generate with the --name option followed by the name of the migration we want to create to create a blank migration file.

The model data has to be created manually.

Conclusion

To auto generate migrations with Sequelize CLI from Sequelize models, we can run sequelize migration:generate.