I have an existing database created with EF 4.1. Then I installed EF 4.3 and enabled migration. Now I changed a name of an entity. The first line of code in the Up() method is DropForeignKey(). If I ran the migration with Update-Database it throws an exception “Could not drop constraint”.
The problem is, that with ef 4.3 the foreign key naming conventions have changed. In 4.3 they look like “FK_Table_Table_Column_ID” in 4.1 like “Table_Table”.
How can I change that?
Are you able to let code-first recreate the database? If you do this, then all the keys will be re-created using the new naming conventions.
I wrote a blog post about this and a few other things to look out for when upgrading to Entity Framework 4.3.