Migration::CheckPending does not respect Rails.application.paths['db/migrate']

I have discovered that unlike the other parts of the migrations system, the Migration::CheckPending Rack module does not respect Rails.application.paths['db/migrate'].

All the rake-driven migrations code benefits from: active_record/railties/databases.rake#L6

ActiveRecord::Migrator.migrations_paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths

``

DatabaseTasks.migration_paths returns the value of Rails.application.paths[‘db/migrate’].

However Migration::CheckPending does not benefit from this.

I’ve been experimenting with ways to fix it, for example this works:

class CheckPending

def initialize(app)

if defined? Rails
ActiveRecord::Migrator.migrations_paths = Rails.application.paths[‘db/migrate’].to_a
end
end

``

Does this look like a viable solution?

Is it something that might ever get merged in?

This is a somewhat unusual situation. I’m doing some experiments on engines/apps, attempting to change their relationships to each other, and discovered this when I moved the migrations folder.

Should I spin up a PR?

Thanks for your consideration,

-Sam.

I wrote that code. Can you give me a PR with tests? Mention @schneems