Let's say I'm a developer and I check out an old version of the code, so that my local database is "ahead", like
local db migrations: A -> B -> C -> D
code migrations: A -> B
How I fix this is by running
Update-Database -TargetMigration -B
in PCM. As I understand, that runs
D.Down()
C.Down()
But where does EF find those methods if they're not in the code I've checked out? Are they in the [Model] columns of __MigrationHistory? I thought that column only stored the model, not migrations.
There is no way that an old version of the code will know how to rollback the database. That information is held in the current version. You need to do Update-Database -TargetMigration -B using the current version then check out the old version.
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