Quantcast
Channel: Redmine: Issues
Viewing all articles
Browse latest Browse all 57

Defect #37686 (New): Plugin migration does not work properly if called multiple times with differ...

$
0
0

When testing plugin migrations it is necessary to call plugin migrations more than once, e.g.:

# migrate to version A
Redmine::Plugin.migrate('some_plugin', 2)

# ...do some plugin specific database filling...

# try to migrate to version B and see if migration gave proper results
Redmine::Plugin.migrate('some_plugin', 3)

The problem is it does not work as expected. Installed migrations are listed and cached in Redmine::Plugin::Migrator@all_versions variable during first migrate() run. Then it is never updated and subsequent migrate() calls operate on its outdated contents.

Quick workaround is to clear @all_versions variable like this:

Redmine::Plugin.migrate('some_plugin', 2)

Redmine::Plugin::Migrator.instance_variable_get(:@all_versions)&.delete('some_plugin')

Redmine::Plugin.migrate('some_plugin', 3)

Viewing all articles
Browse latest Browse all 57

Trending Articles