Exemplo n.º 1
0
        private void RunMigration(MigrationPlanStep step)
        {
            var migrationInfo = step.MigrationInfo;

            if (!migrationInfo.MigratesFor(_databaseKind))
            {
                Log.Info(String.Format(" -> [{0}] {1} {2}() NOT PERFORMED for database {3}", migrationInfo.Version,
                                       migrationInfo.Name, step.Direction, _databaseKind));
                UpdateCurrentVersion(step);
                return;
            }
            Log.Info(String.Format(" -> [{0}] {1} {2}()", migrationInfo.Version, migrationInfo.Name, step.Direction));

            var migration = _migrationFactory.CreateMigration(migrationInfo.MigrationType);

            if (step.Direction == Direction.Up)
            {
                migration.Up();
            }
            else
            {
                migration.Down();
            }
            UpdateCurrentVersion(step);
        }
Exemplo n.º 2
0
 private void UpdateCurrentVersion(MigrationPlanStep step)
 {
     if (!step.ShouldUpdateVersion)
     {
         return;
     }
     if (step.Direction == Direction.Up)
     {
         VersionRepository.InsertVersion(step.MigrationInfo);
     }
     else
     {
         VersionRepository.RemoveVersion(step.MigrationInfo);
     }
 }