public void CanListVersions() { const long version1 = 2011010101; const long version2 = 2011010102; const long version3 = 2011010103; const long version4 = 2011010104; var mockMigration1 = new Mock <IMigration>(); var mockMigration2 = new Mock <IMigration>(); var mockMigration3 = new Mock <IMigration>(); var mockMigration4 = new Mock <IMigration>(); LoadVersionData(version1, version3); _migrationList.Clear(); _migrationList.Add(version1, new MigrationInfo(version1, TransactionBehavior.Default, mockMigration1.Object)); _migrationList.Add(version2, new MigrationInfo(version2, TransactionBehavior.Default, mockMigration2.Object)); _migrationList.Add(version3, new MigrationInfo(version3, TransactionBehavior.Default, mockMigration3.Object)); _migrationList.Add(version4, new MigrationInfo(version4, TransactionBehavior.Default, true, mockMigration4.Object)); _runner.ListMigrations(); _announcer.Verify(a => a.Say("2011010101: IMigrationProxy")); _announcer.Verify(a => a.Say("2011010102: IMigrationProxy (not applied)")); _announcer.Verify(a => a.Emphasize("2011010103: IMigrationProxy (current)")); _announcer.Verify(a => a.Emphasize("2011010104: IMigrationProxy (not applied, BREAKING)")); }
public static void MigrateToLatest(string connectionString, string clientId, string certThumbPrint, string authority) { var announcer = new TextWriterAnnouncer(s => { System.Console.WriteLine(s); System.Diagnostics.Debug.WriteLine(s); }); var assembly = Assembly.Load("MyAppMigrations"); var migrationContext = new RunnerContext(announcer) { Namespace = "MyAppMigrations" }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var factory = new AzureSqlProcessorFactory(clientId, certThumbPrint, authority); using (var processor = factory.Create(connectionString, announcer, options)) { var runner = new MigrationRunner(assembly, migrationContext, processor); runner.ListMigrations(); runner.MigrateUp(true); } }
public virtual void List(MigrationRunner runner, ITaskExecutionContext context, IKernel kernel) { if (runner == null) { throw new ArgumentNullException("runner"); } if (context == null) { throw new ArgumentNullException("context"); } if (kernel == null) { throw new ArgumentNullException("kernel"); } runner.ListMigrations(); }
public void CanListVersions() { const long version1 = 2011010101; const long version2 = 2011010102; var mockMigration1 = new Mock <IMigration>(); var mockMigration2 = new Mock <IMigration>(); LoadVersionData(version1, version2); _migrationList.Clear(); _migrationList.Add(version1, new MigrationInfo(version1, TransactionBehavior.Default, mockMigration1.Object)); _migrationList.Add(version2, new MigrationInfo(version2, TransactionBehavior.Default, mockMigration2.Object)); _runner.ListMigrations(); _announcer.Verify(a => a.Say("2011010101: IMigrationProxy")); _announcer.Verify(a => a.Emphasize("2011010102: IMigrationProxy (current)")); }