Skip to content

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

Robert Greiner
Robert Greiner
1 min read

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.

Please consider subscribing, it's free.
Technology

Robert Greiner Twitter

Professional optimist. I write a weekly newsletter for humans at the intersection of business, technology, leadership, and career growth.


Related Posts

Members Public

Artist for a Day

The future of creative output is multiplied by AI.

Artist for a Day
Members Public

The Auto Industry's Cloud Awakening

Auto manufacturers are behind the cloud adoption curve but are well-positioned to unlock the future of mobility by building foundational capabilities across six key areas.

The Auto Industry's Cloud Awakening
Members Public

Off Topic Thursday: Apple Keynote Event Reflections

Igor and Robert nerd out on the recent Apple Keynote Event from October 13th 2020 and share their reflections about exceptional production value, new products, and Apple’s evolution as an organization.