Simplify count_rows check

We had a line which was too long according to rubocop, and simplifying
the code makes the line shorter.
This commit is contained in:
Javi Martín
2018-11-07 14:10:05 +01:00
parent a6adc0b5ab
commit cb891f21d4

View File

@@ -80,12 +80,17 @@ namespace :milestones do
'description' => 'description'} 'description' => 'description'}
puts "Verifying that all rows were copied..." puts "Verifying that all rows were copied..."
unless count_rows('milestones') == count_rows('budget_investment_milestones') &&
count_rows('milestone_statuses') == count_rows('budget_investment_statuses') && {
count_rows('milestone_translations') == count_rows('budget_investment_milestone_translations') "budget_investment_milestones" => "milestones",
"budget_investment_statuses" => "milestone_statuses",
"budget_investment_milestone_translations" => "milestone_translations"
}.each do |original_table, migrated_table|
unless count_rows(original_table) == count_rows(migrated_table)
raise "Number of rows of old and new tables do not match! Rolling back transaction..." raise "Number of rows of old and new tables do not match! Rolling back transaction..."
end end
end end
end
puts "Finished in %.3f seconds" % (Time.now - start) puts "Finished in %.3f seconds" % (Time.now - start)
end end