Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use EF5 migrate.exe to rollback a code first migration?

I am trying to figure out the commandline line params for the EF5 migrate.exe that will allow me to manually roll back the latest code-first migration - i.e. to apply the Down() function in the latest DbMigration.

NB I have migrate.exe working - I can apply the Up() function - but I don't see any documentation about rollback on the migrate.exe help page: http://msdn.microsoft.com/en-us/data/jj618307.aspx

Anyone know whether this is possible?

like image 838
Ilan Avatar asked Feb 17 '26 14:02

Ilan


1 Answers

Use targetMigration parameter and set it to name of the migration you want to end with. If it is old migration the tool should revert all migrations applied after your selected migration. At least this is how it works in powershell commands.

like image 96
Ladislav Mrnka Avatar answered Feb 21 '26 15:02

Ladislav Mrnka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!