I\'m working on a project using MVC4 in Visual Studio 2012 and have added a column in the table.
Now when I want to debug my project the error says to use the migrat
The error is saying that you have two contexts. When you first create a project using MVC 4, Visual Studio creates a context for your SimpleMembership by default (check Models/Account.cs) or do a ctrl+f for UsersContext, you can just delete this file if you are not using SimpleMembership.
After removing this context, go ahead and add the following to your DefaultConnection class:
protected override void OnModelCreating(DbModelBuilder builder)
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion());
}
If you enabled migrations correctly you should also have a folder called Migrations and inside it a Configuration class, its constructor should look like this (if you want to enable automatic migrations):
public Configuration()
{
AutomaticMigrationsEnabled = true;
}