Example #1
0
 public void Rollback_upgrade_on_fail()
 {
     CreateOldVersionTable();
     InsertOldVersionTableVersionNumber(3);
     try {
         AllMigrations.Add(M1);
         _versionRepository.EnsureSchemaVersionTable(AllMigrations);
         Assert.Fail("Should throw UpgradeSharpMigrationException");
     }
     catch (UpgradeSharpMigrationException ex) {
     }
     Assert.IsFalse(_client.TableExists(VersionRepository.VERSION_TABLE_NAME));
 }
Example #2
0
 public void Rollback_upgrade_on_fail__with_multiple_migration_groups()
 {
     CreateOldVersionTable();
     InsertOldVersionTableVersionNumber(3);
     InsertOldVersionTableVersionNumber(3, "othergroup");
     try {
         _versionRepository.EnsureSchemaVersionTable(AllMigrations);
         _versionRepository.MigrationGroup = "othergroup";
         AllMigrations.Add(M1);
         _versionRepository.EnsureSchemaVersionTable(AllMigrations);
         Assert.Fail("Should throw UpgradeSharpMigrationException");
     }
     catch (UpgradeSharpMigrationException ex) {
     }
     Assert.IsTrue(_client.TableExists(VersionRepository.VERSION_TABLE_NAME));
     Assert.AreEqual(3, QueryVersionTable().Count);
     Assert.AreEqual("default", QueryVersionTable()[0].MigrationGroup);
 }