Overview

Automated Migration

internal sealed class Configuration : DbMigrationsConfiguration<SchoolDBContext>
{
	public Configuration()
	{
		AutomaticMigrationsEnabled = true;
	}
	
	protected override void Seed(SchoolDataLayer.SchoolDBContext context)
	{
		//  This method will be called after migrating to the latest version.
		//  Use the DbSet<T>.AddOrUpdate() method to avoid creating duplicate seed data.
		context.People.AddOrUpdate(
			p => p.FullName,
				new Person { FullName = "Andrew Peters" },
				new Person { FullName = "Brice Lambson" },
				new Person { FullName = "Rowan Miller" }
		);		
	}
}
public class SchoolDBContext: DbContext
{
	public SchoolDBContext(): base("SchoolDBConnectionString")
	{
		Database.SetInitializer(new MigrateDatabaseToLatestVersion<SchoolDBContext,
			SchoolMigrationsConfiguration>("SchoolDBConnectionString"));
	}	
}

Code based Migration

Rollback Database Change