Skip to content

Commit

Permalink
Add line breaks to error logs
Browse files Browse the repository at this point in the history
Ref: jenseng#36

Co-authored-by: Alex Ghiculescu <[email protected]>
  • Loading branch information
joshuay03 and ghiculescu committed May 8, 2024
1 parent 7678630 commit e9f8552
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/immigrant/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
Rails.application.eager_load!

keys, warnings = Immigrant::KeyFinder.new.infer_keys

$stderr.puts if warnings.values.any?
warnings.values.each { |warning| $stderr.puts "WARNING: #{warning}" }

$stderr.puts if keys.any?
keys.each do |key|
column = key.options[:column]
pk = key.options[:primary_key]
$stderr.puts "Missing foreign key relationship on '#{key.from_table}.#{column}' to '#{key.to_table}.#{pk}'"
end

if keys.any?
puts 'Found missing foreign keys, run `rails generate immigration MigrationName` to create a migration to add them.'
$stderr.puts
$stderr.puts 'Found missing foreign keys, run `rails generate immigration MigrationName` to create a migration to add them.'
exit keys.count
end
end
Expand Down

0 comments on commit e9f8552

Please sign in to comment.