class ActiveRecord::PendingMigrationError

:nodoc:

def connection_pool

def connection_pool
  ActiveRecord::Tasks::DatabaseTasks.migration_connection_pool
end

def detailed_migration_message(pending_migrations)

def detailed_migration_message(pending_migrations)
  message = "Migrations are pending. To resolve this issue, run:\n\n        bin/rails db:migrate"
  message += " RAILS_ENV=#{::Rails.env}" if defined?(Rails.env) && !Rails.env.local?
  message += "\n\n"
  message += "You have #{pending_migrations.size} pending #{pending_migrations.size > 1 ? 'migrations:' : 'migration:'}\n\n"
  pending_migrations.each do |pending_migration|
    message += "#{pending_migration.filename}\n"
  end
  message
end

def initialize(message = nil, pending_migrations: nil)

def initialize(message = nil, pending_migrations: nil)
  if pending_migrations.nil?
    pending_migrations = connection_pool.migration_context.open.pending_migrations
  end
  super(message || detailed_migration_message(pending_migrations))
end