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.
Undoing Migrations With migration you can revert to old state by just running a command. You can use db:migrate:undo , this command will revert most the recent migration.
To check for status, run rails db:migrate:status . Then you'll have a good view of the migrations you want to remove. Then, run rails db:rollback to revert the changes one by one. After doing so, you can check the status again to be fully confident.
“delete migration record sequelize” Code Answer's // You can use db:migrate:undo, this command will revert most recent migration.
Use name
option:
db:migrate:undo --name 20180704124934-create-branch.js
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