Unable to generate explicit migration (EF5) (migrations pending)

ef-migrations entity-framework indexing localdb

Popular Answer

It's possible that this won't help with the OP's question, but I ran into a problem when I tried to apply two migrations to a new database before performing any database updates.

I decided to launch my application as a workaround so that any upcoming migrations may update the database. A MigrateDatabaseToLatestVersion is used by the application to automatically update the database. You can do this by keying in.Update-Database additionally from the Package Manager Console.

There is also no need to remove and re-add a migration if it is introduced and further changes are made that should also be added to the migration (which I tried to do at first). When using the Add-Migration tool from the Package Manager Console, you may simply update the currently pending migration (emphasis by me).

The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration [Timestamp]_MigrationName' again.

In other words, the new changes will be merged with the old if you execute the Add-Migration tool with the same Id as the pending operation. If the modifications are not merged after you detect it, you can utilize the-F banner (as inAdd-Migration <Name> -Force ), as anthony-arnold points out in the comments, in order to force the migration.

8
10/13/2014 7:37:57 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow