public void Drop() { this._createDrop.SQL_Drop_tables(); IDBMigrator migrator = new SQLServerDBMigrator(this._db, new DefaultDBMigrationStepProvider(Enumerable.Empty <IDBMigrationStep>())); new Result(migrator.UnInstall); new Result(() => DropTableCliente(this._db)); }
public void SQLServerDBMigrator_tests() { IDBMigrator migrator = new SQLServerDBMigrator(this._db, new DefaultDBMigrationStepProvider(GetMigrations())); int version = migrator.GetCurrentVersion(); var migrationStep = migrator.GetLastMigration(); Assert.AreEqual(0, version); Assert.AreEqual(new DateTime(0), migrationStep.MigrationDate); Assert.AreEqual(0, migrationStep.Version); IEnumerable <MigrationInfo> steps = migrator.Upgrade(); version = migrator.GetCurrentVersion(); migrationStep = migrator.GetLastMigration(); Assert.AreEqual(3, version); Assert.AreEqual(3, migrationStep.Version); Assert.AreEqual(_kMigration3, migrationStep.Description); Assert.AreEqual(2, steps.Count()); steps = migrator.Upgrade(); Assert.IsFalse(steps.Any()); version = migrator.GetCurrentVersion(); migrationStep = migrator.GetLastMigration(); Assert.AreEqual(3, version); Assert.AreEqual(3, migrationStep.Version); Assert.AreEqual(_kMigration3, migrationStep.Description); //simulating error on migration from 3 to 4 migrator = new SQLServerDBMigrator(this._db, new BadMigrationProvider()); steps = migrator.Upgrade(); Assert.IsFalse(steps.Any()); version = migrator.GetCurrentVersion(); migrationStep = migrator.GetLastMigration(); Assert.AreEqual(3, version); Assert.AreEqual(3, migrationStep.Version); Assert.AreEqual(_kMigration3, migrationStep.Description); }