Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Roll back a specific migration without rolling back other migrations

I mistakenly ran the second to last db migration wrong, but the last migration is fine. Now I want to roll back my second to last migration without reverting the last migration. Please share your knowledge with me and others.

like image 469
Awais Avatar asked May 05 '14 08:05

Awais


3 Answers

rake db:migrate:down VERSION=20140804301246
like image 197
Santhosh Avatar answered Nov 15 '22 21:11

Santhosh


simple answer i found is

rake db:rollback STEP=X 

where X is the number of migration you want to play with(rollback). LIKE

rake db:rollback STEP=3
like image 34
Awais Avatar answered Nov 15 '22 21:11

Awais


You can use rake db:migrate:down VERSION=xxxxx where xxx is your migration version number for more see this

like image 32
Wit Wikky Avatar answered Nov 15 '22 19:11

Wit Wikky