EF6 "No migrations have been applied to the target database."
Well, the answer is that somehow during the refactor the namespace of ConfigurationDbContext
changed from
demo10.Migrations.ConfigurationDbContext
to
demo10.Migrations.ConfigurationDbContext.ConfigurationDbContext
and the ContextKey
column of the __MigrationHistory
table should be the ConfigurationDbContext
namespace (you can omit the DbContext, like to have
demo10.Migrations.Configuration
in the table for
demo10.Migrations.ConfigurationDbContext
namespace).
Leaving an answer here as I had a similar problem that wasn't solved by this:
I had the password wrong in the app.config I was using against a different environment. Get-Migrations doesn't give you an error about failed credentials, it just tells you "No migrations have been applied to the target database", which is hugely misleading.
Hopefully someone else who comes across this will discover it's as simple as a typo in their connection string!
edit: the irony of typo-ing the word typo in an answer about my typo.