Example #1
0
 public void Migrate(IEnumerable <IStep> migrationSteps, DatabaseVersion currentVersion, long?targetVersion, IScriptRunner scriptRunner, string schema, string tablespace)
 {
     if (_databaseMetadataProvider.SchemaExists(schema))
     {
         TerminateDatabase(migrationSteps.Select(m => m.BackwardScript), scriptRunner, schema);
     }
 }
Example #2
0
 public void Migrate(IEnumerable <IStep> migrationSteps, DatabaseVersion currentVersion, long?targetVersionNumber, IScriptRunner scriptRunner, string schema, string tablespace)
 {
     if (_databaseMetadataProvider.SchemaExists(schema))
     {
         if (_versionRespository.GetCurrentVersion(schema).IsNotNull())
         {
             var orderByDescending = migrationSteps.Select(m => m.BackwardScript).Where(m => m.IsNotNull()).OrderByDescending(m => m.Version);
             DowngradeDatabase(orderByDescending, currentVersion, targetVersionNumber, scriptRunner, schema);
         }
         else
         {
             Output.Warn("Database schema '{0}' exists, but there are no recorded database versions. Database was most likely not terminated.".FormatWith(schema));
         }
     }
 }