Schemas and data migration for node js

Is there any tool that works similar to Django South, but for Node?

I am currently working with Sequelize. If I understood correctly, Sequelize is not able to create migration files based on existing models. So, to create a new model / table, follow these steps:

  • Create a model using sequelize model:create <model meta> .
  • Edit the generated migration file - add the current code for creating tables in the database in the up section.
  • Start the migration using sequelize db:migrate .

I am looking for something that can create migration files based on existing models, manage them similar to what South can do for Django.

Is there an option?

+6
source share
1 answer

The closest thing with the Sequelize sequence of automatic migration .

This allows you to have an iteration loop similar to the following:

  1. Create / update model - manually or using sequelize-cli )
  2. Run makemigrations to automatically generate up and down migrations
  3. Repeat as necessary

Although it is very useful, I found that it is lacking in some critical areas:

  1. Down migrations may not be created correctly. Therefore, he may try to delete the table before its dependent tables are deleted.
  2. There are certain configurations around multi-field indexes that are not displayed correctly.

Currently, there are 10 outstanding PRs , so it seems that several additional authors are trying to make it more ready to work ... but I still have to find something as clean and reliable as Django Migrations (formerly) Django South).

0
source

All Articles