Is there any tool that works similar to Django South, but for Node?
Now I'm working with Sequelize. If I got it right, Sequelize does not have an option to create migration files based on existing models. So, to create a new model/table, the steps are:
sequelize model:create <model meta>
. up
section.sequelize db:migrate
.I'm looking for something that can create migration files based on existing models, manage it similar to what South can do for Django.
Is there any option?
Database migrations, also known as schema migrations, database schema migrations, or simply migrations, are controlled sets of changes developed to modify the structure of the objects within a relational database.
Migrations are performed programmatically by using a schema migration tool. When invoked with a specified desired schema version, the tool automates the successive application or reversal of an appropriate sequence of schema changes until it is brought to the desired state.
A migration file contains code to apply the changes, and code to remove the changes again. With that format, it's possible to switch (migrate) between one set of changes and another pretty seamlessly. Again, there are tons of modules out there that provide database migrations for node. js .
A mongoose schema defines the shape of documents inside a particular collection.
I have written a step-by-step guide on how to auto-create migrations with Sequelize in another post. Here is a summary...
The closest thing with Sequelize is Sequelize Auto Migrations.
It allows you to have an iteration cycle like the following:
sequelize-cli
)makemigrations
to auto-generate up
and down
migrationsWhile this is very helpful, I've found it to be lacking in some critical areas:
There are currently 10 outstanding PRs, so it seems like a few additional contributors are attempting to make it more production-ready... but I've yet to find anything as clean and reliable as Django Migrations (formerly Django South).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With