On 3 Jan 2011, at 13:18, Sem Ptiri <[email protected]> wrote:
> 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. Fred > I've defined the 'other' databases connections in my classes: > > class OtherApp < ActiveRecord::Base > self.abstract_class = true > establish_connection :otherApp1_development # defined in database.yml > > def initialize > self.establish_connection > end > end > > Yet when I use: > > class CreateApplicationExampleOne < OtherApp > def self.up > # definitions etc > end > end > > and then try to migrate, it fails. > > I hope I'm missing something small here. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

