EF Migration object already exists error

asp.net-mvc c# ef-code-first entity-framework

Question

Entity Framework is being used in an ASP.NET MVC project I'm working on that pulls code first from a database. I get the models for every database table. I modified the models and enabled migrations, however when I start the migration I get the following error:

There is already an object named 'TableName' in the database."

I experimentedupdate-database -force but was useless. The tables that already exist are created during the first transfer!

How can the first migration update the models without starting from scratch with new tables?

And in this situation, what is the appropriate procedure for synchronising changes between the database and models?

1
15
6/30/2016 5:01:19 PM

Accepted Answer

ZZZ_tmp
27
6/30/2016 4:50:07 PM

Popular Answer

ZZZ_tmp


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