Search code examples
javascriptnode.jsmigrationsequelize.jssequelize-cli

Revert Only One of Two Migrations in Sequelize-CLI?


If we created 2 new migration scripts and ran

sequelize-cli db:migrate

, both migration scripts will run.

Both migrations are also reverted when we ran once the command

sequelize-cli db:migrate:undo

Question: Can we undo only the latest of the 2 migrations?

Using node 13.7.0, sequelize 5.21.3, sequelize-cli 5.5.1, PostgreSQL 11.2.


Solution

  • Use name option:

    db:migrate:undo --name 20180704124934-create-branch.js