I've got an Entity Framework 6 application. I've ported the database from SQL Server to PostgreSQL. Now when I run the application I'm getting this error:
The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).
The only thing is that the database schema shouldn't have changed. If it has, there is something wrong with my port which needs fixing. I do not want to run a migration to bring the database up to the new version. I want to find out what the change was that has caused this so that I can correct it.
Does anyone know how Entity Framework decides whether the database is out of date and what causes it to raise this error?
Entity Framework stores migration history and the state of your database model in a table called MigrationHistory.
I suggest not modifying this, however. Instead, as a workaround, you can add a new migration, delete whatever content is inside of the
Up() method, and then update your database. This will update the history to match what you currently have.
However when you add the migration, you may want to review the code it produces first to see what EF thinks has changed. It might actually be a legitimate migration.