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

24 views
Skip to first unread message

Sam Pierson

unread,
May 24, 2015, 3:09:12 PM5/24/15
to rubyonra...@googlegroups.com
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.

richard schneeman

unread,
May 24, 2015, 10:53:15 PM5/24/15
to rubyonra...@googlegroups.com, rubyonra...@googlegroups.com
I wrote that code. Can you give me a PR with tests? Mention @schneems


Sent from Mailbox


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages