I don’t get how sequelize migrations workflow works. I have a greenfield project, the database is designed using SQL scripts. We used sequelize auto
to generate the models thereafter.
I need to now generate a migrations file starting out, so I can run the CLI to run SQL queries to create new tables with columns etc for locally provisioned databases.
There’s no 3rd party tools afaik to convert the SQL script I have into a Sequelize migrations file. I have to do this manually for 60 tables. There is a script method of auto-creating it, but it uses a seperate format that doesn’t have backward compatability for undoing migrations (sequelize-auto-migrations).
When I update the sequelize model schema in my file, there’s not a one off way command to have migrations file synchronize to those changes, via a diffing mechanisms based off the last migration execution ran.
This means I have to modify the model, AND modify the migrations file, leading to potential human error and duplicate redundant work.
so my issues are
- does sequelize have a way to initialize the first migrations file?
- is there a tool I can use when I modify models in sequelize, and generate the new migrations file automatically based off some diffing mechanism?