If you’ve somehow been volunteered to upgrade a project that was using Entity Framework 4.1 to Entity Framework 4.3 and you are trying in vain to get the new Code First Migrations to work, the simplest solution I’ve come across so far is to simply delete the EdmMetadata table in your database.
Usually, you’ll find yourself getting the following error when you run the “Update-Database” command in the Package Manager Console:
Cannot scaffold the next migration because the target database was created with a version of Code First earlier than EF 4.3 and does not contain the migrations history table. To start using migrations against this database, ensure the current model is compatible with the target database and execute the migrations Update process. (In Visual Studio you can use the Update-Database command from Package Manager Console to execute the migrations Update process).
There are some solutions posted already, but the caveat with these is that you have to run the “Add-Migration InitialMigration -IgnoreChanges” before you make any changes to your models. Woops. RTFM, I guess.
Anyway, deleting EdmMetadata manually and then running the “add-migration initialmigration -ignorechanges” seemed to do the trick.