Is it possible to use Postgres schemas within a Rails app to separate tables and data between two different apps?
I am thinking of combining two apps. I want to share some data (certain tables) between them, but I want the migrations and other activities to be separated. I don’t want any table changes in one app to impact the other.
App 1 contains order entry. App 2 contains contact management. In App 2, I want to access the order history for a customer/contact. So, I create an order model in App 2 and set the table name to include the schema…e.g. set_table_name "
However, I want both apps to have their own migrations. How do I tell Rails to use a particular schema when doing migrations, fixture loads, etc.?
The other reasonable option seems to be multiple database connections in each app, which I haven’t investigated much yet. I have read a little about the “magic” multi-connection stuff. I am just thinking the schema thing in Postgres might be a cleaner (read…easier for me) solution.
Any tips, alternatives, or berating on why not to pursue this would be appreciated.