KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have been using Entity Framework (5.0) for a while now in a project (ASP.NET MVC in VS2012 Express). Right now, though, I am no longer able to add migrations. PM > Add-Migration -projectName MyProject.DAL TestMigration 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. I do not know if this gives any clue but the 'Unable to ..." text is displayed in red. I have tried to enable automatic migration (which makes no sense as I am trying to write the pending model changes to a code-based migration) and that results in the required migration in the database. However this is not what I want because I then I do not have a migration in the project. I have tried to remove the database and recreate the database. The database is recreated (up to the previous migration) but when I then try to use the Add-Migration I still get the "Unable to update.." error. Edit I tried the -force parameter but with no difference. The contents of my configuration class (I did not change anything after the previous migration): public Configuration() { AutomaticMigrationsEnabled = false; } protected override void Seed(Bekosense.DAL.Context.BekosenseContext context) { context.Database.ExecuteSqlCommand(Properties.Resources.TriggerAlertMessageDrop); context.Database.ExecuteSqlCommand(Properties.Resources.TriggerAlertMessageCreate); context.Database.ExecuteSqlCommand(Properties.Resources.TriggerAlertMessageSentDrop); context.Database.ExecuteSqlCommand(Properties.Resources.TriggerAlertMessageSentCreate); context.Database.ExecuteSqlCommand(Properties.Resour
Tags (comma-separated)
Save Edits
Cancel