Skip to content

Instantly share code, notes, and snippets.

@dcrosby42
Created February 1, 2011 05:08
Show Gist options
  • Save dcrosby42/805447 to your computer and use it in GitHub Desktop.
Save dcrosby42/805447 to your computer and use it in GitHub Desktop.
Utility code that uses MigratorDotNet to execute full sweep migrations.
namespace UnitTests.TestHelpers
{
public class MigrationTestHelper
{
public static readonly string Provider = "SqlServer";
public static readonly string ConnectString = "Database=myapp_test;Data Source=localhost;User Id=myUser;Password=abc123";
public static Migrator.Migrator GetMigrator()
{
var assembly = Assembly.GetAssembly(typeof(BootstrapAspDotNetAuthTables));
return new Migrator.Migrator(Provider, ConnectString, assembly);
}
public static void MigrateAllTheWayUp()
{
GetMigrator().MigrateToLastVersion();
}
public static void MigrateAllTheWayDown()
{
GetMigrator().MigrateTo(0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment