示例#1
0
 private void UpdateCurrentVersion(MigrationPlanStep step)
 {
     if (!step.ShouldUpdateVersion)
     {
         return;
     }
     if (step.Direction == Direction.Up)
     {
         _versionRepository.InsertVersion(step.MigrationInfo);
     }
     else
     {
         _versionRepository.RemoveVersion(step.MigrationInfo);
     }
 }
示例#2
0
        private void RunMigration(MigrationPlanStep step)
        {
            var migrationInfo = step.MigrationInfo;

            if (!migrationInfo.MigratesFor(_databaseKind))
            {
                Log($" -> [{migrationInfo.Version}] {migrationInfo.Name} {step.Direction}() NOT PERFORMED for database {_databaseKind}");// $" -> [{migrationInfo.Version}] {migrationInfo.Name} {step.Direction}() NOT PERFORMED for database {_databaseKind}");
                UpdateCurrentVersion(step);
                return;
            }
            Log(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);
        }