Introduction
Unable to update database to match the current model because there are pending changes
Technology

Unable to update database to match the current model because there are pending changes

Update-Database

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.

This error occurs when you have pending changes in your database migrations that have not been added yet. If you find this error staring you in the face during your programming adventures, simply type Add-Migration. This will take all of the database updates you have made (inadvertently or explicitly) since the last migration and add them to a new database migration file.

Once your pending changes are all synced up, Update-Database will work again.

Robert Greiner
Author

Robert Greiner

Professional optimist. Passionate about cultivating high-performing teams @ scale by integrating the timeless wisdom of the past with the marvel of today's emergent technology in a practical way.

View Comments
Next Post

The AudienceRestrictionCondition was not valid because the specified Audience is not present in AudienceUris

Previous Post

Using Entity Framework Database Migrations to Update a Remote SQL Azure Database

Subscribe for free

Subscribe to my newsletter and get the latest posts delivered right to your inbox for free. I don't spam and your email won't be shared with third-parties.

Thanks for subscribing!

Check your inbox to confirm your subscription.

Please enter a valid email address!