I am referring https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/migrations/existing-database

I am using Entity frame work Code First Migrations for an existing database.

I get the below error

Error Number:2714,State:6,Class:16 There is already an object named 'MyGroups' in the database.

I can comment out the table creation script, but is it right way? Why it is not detecting existence to table and skip the creation?

In production we may not have any database. In such cases it shall create the database. Basically how do I automate DB creation based on environments? or how do I make sure existing data not getting affected by migration.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.