FIX: Don't run seeds if multisite migration fails.
This commit is contained in:
parent
e8328968bb
commit
1d281353b6
|
@ -160,15 +160,33 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
|
||||||
end.each(&:join)
|
end.each(&:join)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_exceptions(exceptions)
|
||||||
|
if exceptions.length > 0
|
||||||
|
STDERR.puts
|
||||||
|
STDERR.puts "-" * 80
|
||||||
|
STDERR.puts "#{exceptions.length} migrations failed!"
|
||||||
|
while !exceptions.empty?
|
||||||
|
db, e = exceptions.pop
|
||||||
|
STDERR.puts
|
||||||
|
STDERR.puts "Failed to migrate #{db}"
|
||||||
|
STDERR.puts e.inspect
|
||||||
|
STDERR.puts e.backtrace
|
||||||
|
STDERR.puts
|
||||||
|
end
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
execute_concurently(concurrency, exceptions) do |db|
|
execute_concurently(concurrency, exceptions) do |db|
|
||||||
puts "Migrating #{db}"
|
puts "Migrating #{db}"
|
||||||
ActiveRecord::Tasks::DatabaseTasks.migrate
|
ActiveRecord::Tasks::DatabaseTasks.migrate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
check_exceptions(exceptions)
|
||||||
|
|
||||||
SeedFu.seed(SeedHelper.paths, /001_refresh/)
|
SeedFu.seed(SeedHelper.paths, /001_refresh/)
|
||||||
|
|
||||||
execute_concurently(concurrency, exceptions) do |db|
|
execute_concurently(concurrency, exceptions) do |db|
|
||||||
|
|
||||||
puts "Seeding #{db}"
|
puts "Seeding #{db}"
|
||||||
SeedFu.seed(SeedHelper.paths, SeedHelper.filter)
|
SeedFu.seed(SeedHelper.paths, SeedHelper.filter)
|
||||||
|
|
||||||
|
@ -178,21 +196,7 @@ task 'multisite:migrate' => ['db:load_config', 'environment', 'set_locale'] do |
|
||||||
end
|
end
|
||||||
|
|
||||||
$stdout = old_stdout
|
$stdout = old_stdout
|
||||||
|
check_exceptions(exceptions)
|
||||||
if exceptions.length > 0
|
|
||||||
STDERR.puts
|
|
||||||
STDERR.puts "-" * 80
|
|
||||||
STDERR.puts "#{exceptions.length} migrations failed!"
|
|
||||||
while !exceptions.empty?
|
|
||||||
db, e = exceptions.pop
|
|
||||||
STDERR.puts
|
|
||||||
STDERR.puts "Failed to migrate #{db}"
|
|
||||||
STDERR.puts e.inspect
|
|
||||||
STDERR.puts e.backtrace
|
|
||||||
STDERR.puts
|
|
||||||
end
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
Rake::Task['db:_dump'].invoke
|
Rake::Task['db:_dump'].invoke
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue