Categories
JavaScript Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *