Project

General

Profile

Defect #31116 » 0001-Fixes-plugin-migration-with-specific-version.patch

Anonymous, 2019-03-28 23:51

View differences:

lib/redmine/plugin.rb
def open
Migrator.new(:up, migrations, nil)
end
def migrate(target_version = nil, current_version = nil)
case
when target_version.nil?
up(target_version)
when current_version == 0 && target_version == 0
[]
when current_version && current_version > target_version
down(target_version)
else
up(target_version)
end
end
end
class Migrator < ActiveRecord::Migrator
......
# Runs the migrations from a plugin, up (or down) to the version given
def migrate_plugin(plugin, version)
self.current_plugin = plugin
return if current_version(plugin) == version
current = current_version(plugin)
return if current == version
MigrationContext.new(plugin.migration_directory).migrate(version)
MigrationContext.new(plugin.migration_directory).migrate(version, current)
end
def get_all_versions(plugin = current_plugin)
(1-1/3)