I use EF 6, and when I start Update-Database, it tries to apply every migration from the very beginning of the project, even if the new migration is only new.
If I try to create an empty migration, I get an error saying that I cannot create a new migration, since explicit migrations are expected.
The only blog post I found with a similar problem suggested abandoning the table __MigrationHistoryand doing Update-Database -Scriptit by deleting all the actual database changes, but leaving in Create __MigrationHistoryand Migration Inserts. I did not drop the table, but I renamed it, and this did not solve the problem for me.
This question looks like a duplicate, but when I run the script, I see that my context key has not changed, so this is not my problem.
What is strange, I added a column to my model, and then did it add-migrationwithout problems. Then I went to lunch (but did not Update-Database), then after lunch I decided to add another column to my model, and when I did add-migration -forceagain, this error started. I completely rolled back the workspace (completely deleted the workspace and deleted all the code from my machine), but the problem persists.
I am in a team environment, but we each use our own developer database, and I checked the connection string in the Migrations App.Config file is correct.
SQL Profiler Update-Database -Script, 24 (12 2):
IF db_id(N'ISEPDBContexts.AdministratorDb') IS NOT NULL SELECT 1 ELSE SELECT Count(*) FROM sys.databases WHERE [name]=N'ISEPDBContexts.AdministratorDb'
, , .