1

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 1

3

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.

2
  • that's what I want to do eventually but, for now, given time constraint, I need a quick solution to do this. Commented Aug 14, 2012 at 2:43
  • denniss. I wonder if you did migrate entirely to PG, or whether you found a "quick solution". Commented May 9, 2013 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.