public void RollbackOnlyOneStepsOfTwoShouldNotDeleteVersionInfoTable() { const long fakeMigrationVersion = 2009010101; const long fakeMigrationVersion2 = 2009010102; Assert.NotNull(_runner.VersionLoader.VersionTableMetaData.TableName); LoadVersionData(fakeMigrationVersion, fakeMigrationVersion2); _runner.VersionLoader.LoadVersionInfo(); _runner.Rollback(1); _fakeVersionLoader.DidRemoveVersionTableGetCalled.ShouldBeFalse(); }
public static void MigrateDown(string connectionString, long?migrationId) { var announcer = GetAnnouncer(); var assembly = Assembly.GetAssembly(typeof(Seed)); var migrationContext = new RunnerContext(announcer) { Namespace = typeof(Seed).Namespace }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var factory = new FluentMigrator.Runner.Processors.SqlServer.SqlServer2008ProcessorFactory(); using (var processor = factory.Create(connectionString, announcer, options)) { var runner = new MigrationRunner(assembly, migrationContext, processor); if (migrationId.HasValue) { runner.RollbackToVersion(migrationId.Value); } else { runner.Rollback(int.MaxValue); } } }
public virtual void Rollback(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"); } if (runner.RunnerContext.Steps == 0) { runner.RunnerContext.Steps = 1; } runner.Rollback(runner.RunnerContext.Steps); }
public void Rollback() { _runner.Rollback(Int32.MaxValue); }