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
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
for “C” DB use transitive class like
class SharedModelBase < ActiveRecord::Base
self.abstract_class = true
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.