2
votes

I'm wanting to generate migration files for /models/model_name.js (model) files. Although I haven't found a way todo this yet.

So say I created a model articles with just an id field, and then I edited that models/articles.jsfile, how can I use the sequelize cli to generate a migration file, so I can then update my database structure?!

2

2 Answers

0
votes

There is currently no way to auto-generate Sequelize.js model migrations. See this question and its answers also: How to auto generate migrations with Sequelize CLI from Sequelize models?.

0
votes

Install this npm:

Sequelize-mig

pretty updated and new

Install it with:

npm install sequelize-mig -g / yarn global add sequelize-mig

You can use it like this

sequelize-mig migration:make -n <migration name>

and it will generate the migration file by reading your changes and comparing them