I have a Rails reporting application that will generate reports for
other Rails applications.
As such I need to import legacy databases, but might also over time,
change them.
How do I handle migrations with having, and connecting to, x number of
databases?
You'd want to establish_connection on ActiveRecord::Base, since that's what create_table etc will use. I'm not sure what will happen with your schema_migrations table (which is how it determines what migrations to one), out of the box rails will always look at your primary database for this. You might find it easier to define a rails env for each of these databases and then run migrate for each such environment.