I have a rails app that uses MySQL for authentication and storing models. I currently am thinking of using PostgreSQL for analytics (by taking advantage of its special data types like arrays and KV pairs). I am just wondering how I would be able to have two types of databases (1 for models and authentication and 1 for analytics) when trying to save records using ActiveRecord. I want to save the model for analytics in Postgres and other models in MySQL.
1 Answer
My advice would be to migrate completely to PostgresSQL if you want to use it for anything. It'll make your life a lot simpler.
I believe your best answer otherwise will be to stop inheriting from ActiveRecord::Base for your models here. Instead include ActiveRecord, and manually call establish_connection.
But yeah, just migrate to PG. It'll save a lot of trouble.
-
that's what I want to do eventually but, for now, given time constraint, I need a quick solution to do this.denniss– denniss08/14/2012 02:43:35Commented Aug 14, 2012 at 2:43
-
denniss. I wonder if you did migrate entirely to PG, or whether you found a "quick solution".Qoheleth-Tech– Qoheleth-Tech05/09/2013 18:13:08Commented May 9, 2013 at 18:13