Separate DB with rails 3 and mysql

Hi guys,

We have two RoR projects with some similar data in DB let’s say DB “A”
and DB “B”.
My task is to store all similar tables with data in one DB - the “C” DB,
plus remove unnecessary
tables from “A”, “B”.

I want to find the best way how to do it. The goal is to get the same or
better performance
of work with DB and don’t make a lot of updates in the source code.
I have 4 solutions for that:
a) to create one main DB “C” with similar tables and views for that
tables in “A” and “B”
databases and use them through models;
b) to create one main DB, add new data for DB connection in database.yml
and
for “C” DB use transitive class like
class SharedModelBase < ActiveRecord::Base
self.abstract_class = true
establish_connection(ActiveRecord::Base.configurations[“shared_db_connection_#{RAILS_ENV}”])
end
c) to create one main DB “C” and use db-charmer gem for changing db;
d) to use mysql replication with two main DB “A”, “B”;

Could you write me some pros and cons for each solution or some advices.
Also it would be great to know about performance of queries with joins
when we make select on two tables from different db.

Thanks.

On 25 October 2011 17:21, Ivan Z. [email protected] wrote:

Hi guys,

We have two RoR projects with some similar data in DB let’s say DB “A”
and DB “B”.
My task is to store all similar tables with data in one DB - the “C” DB,
plus remove unnecessary
tables from “A”, “B”.

Would not a simpler solution be to completely combine the databases
into one new db for both apps.

Colin

for “C” DB use transitive class like
Posted via http://www.ruby-forum.com/.


You received this message because you are subscribed to the Google G. “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.


gplus.to/clanlaw

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs