Commit a457fb6889c6c50ad92791ef013a4333034862fd
1 parent
fbbb2470
Exists in
master
and in
22 other branches
Fix database upgrade with plugin promoted to base
When a system that has plugin X enabled gets upgraded to a version where plugin X has been promoted to be a base plugins (i.e. a symlink in baseplugins/), `rake db:migrate` would blow up with Multiple migrations have the version number 12345678901234 Note that we probably don't need to do this deduplication everywhere else, because the Ruby $LOAD_PATH already works by giving prioriry to the first path that is found.
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
lib/tasks/plugins.rake
... | ... | @@ -7,7 +7,11 @@ namespace :noosfero do |
7 | 7 | plugin_migration_dirs = Dir.glob(Rails.root.join('{baseplugins,config/plugins}', '*', 'db', 'migrate')) |
8 | 8 | |
9 | 9 | task :load_config do |
10 | - dirs = Dir.glob("{baseplugins,config/plugins}/*/db/migrate") | |
10 | + dirs = Dir.glob("{baseplugins,config/plugins}/*").uniq do |dir| | |
11 | + File.basename(dir) | |
12 | + end.map do |dir| | |
13 | + File.join(dir, 'db/migrate') | |
14 | + end | |
11 | 15 | dirs.each do |dir| |
12 | 16 | ActiveRecord::Migrator.migrations_paths << dir |
13 | 17 | end | ... | ... |