Commit 9480ef0322a8c0ee494d3875c785e0129ef04a25

Authored by Antonio Terceiro
1 parent 401fd69d

List all pending migrations at once

The way it worked before only listed the pending migrations from the
first plugin, because the task was aborted before listing the pending
migrations from the other plugins
Showing 1 changed file with 8 additions and 8 deletions   Show diff stats
lib/tasks/plugins.rake
@@ -8,16 +8,16 @@ namespace :noosfero do @@ -8,16 +8,16 @@ namespace :noosfero do
8 end 8 end
9 task :abort_if_pending_migrations do 9 task :abort_if_pending_migrations do
10 if defined? ActiveRecord 10 if defined? ActiveRecord
11 - plugin_migration_dirs.each do |path|  
12 - pending_migrations = ActiveRecord::Migrator.new(:up, path).pending_migrations 11 + pending_migrations = plugin_migration_dirs.map do |path|
  12 + ActiveRecord::Migrator.new(:up, path).pending_migrations
  13 + end.flatten
13 14
14 - if pending_migrations.any?  
15 - puts "You have #{pending_migrations.size} pending migrations:"  
16 - pending_migrations.each do |pending_migration|  
17 - puts ' %4d %s' % [pending_migration.version, pending_migration.name]  
18 - end  
19 - abort %{Run "rake db:migrate" to update your database then try again.} 15 + if pending_migrations.any?
  16 + puts "You have #{pending_migrations.size} pending migrations:"
  17 + pending_migrations.each do |pending_migration|
  18 + puts ' %4d %s' % [pending_migration.version, pending_migration.name]
20 end 19 end
  20 + abort %{Run "rake db:migrate" to update your database then try again.}
21 end 21 end
22 end 22 end
23 end 23 end