0
votes

I have been using a Code-First approach with my existing database by mapping the tables in my DbContext file and so forth.

Everything works great, but I'd like to be able to do a migration on top of my existing database structure without using the automatically generated migration code to create the database from scratch OR setting AutomaticMigrationEnabled = True

Right now I am getting this error with a perfectly acceptable initial migration file that does not include the previously existing structure:

Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.

You can use the Add-Migration command to write the pending model changes to a code-based migration.

What do I need to do to run this migration?

1

1 Answers

0
votes

I found this tip on Youtube from Fabio Scopel about Code First Migrations - How to update a database schema.

http://www.youtube.com/watch?v=i7SDd5JcjN4