Skip to content

Commit

Permalink
fixup! Add support Rails 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavSokov committed Jun 7, 2024
1 parent b97b245 commit e1507c2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/actual_db_schema/commands/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@ def preambule
puts "\nPhantom migrations\n\n"
puts "Below is a list of irrelevant migrations executed in unmerged branches."
puts "To bring your database schema up to date, the migrations marked as \"up\" should be rolled back."
db_config = if ActiveRecord::Base.respond_to?(:connection_db_config)
ActiveRecord::Base.connection_db_config.configuration_hash
else
ActiveRecord::Base.connection_config
end
database_path = db_config[:database]
puts "\ndatabase: #{database_path}\n\n"
puts header.join(" ")
puts "-" * separator_width
end

def db_config
if ActiveRecord::Base.respond_to?(:connection_db_config)
ActiveRecord::Base.connection_db_config.configuration_hash
else
ActiveRecord::Base.connection_config
end
end

def separator_width
header.map(&:length).sum + (header.size - 1) * 2
end
Expand Down

0 comments on commit e1507c2

Please sign in to comment.