user1051849
user1051849

Reputation: 2337

Share a heroku basic postgres DB between 2 heroku apps

Having googled it (and looked on the heroku site) - i just can't find a set for instructions for setting a new rails app's database connection to be to a basic db created for a different (earlier) app. I know there's something to do with swapping the "color" of the databases available - but i have no idea how... and links or any simple instructions massively appreciated.

ps - i gave seen this question, but it is a couple of years old, and it seems things have moved on at heroku since then.

Upvotes: 5

Views: 2443

Answers (2)

Jimmy Johnson
Jimmy Johnson

Reputation: 908

Go into the directory you are pushing to Heroku and type the following:

heroku config:set DATABASE_URL=`heroku config:get DATABASE_URL -a other-app`

Where "other-app" is the database from the app you created earlier. For example:

heroku config:set DATABASE_URL=`heroku config:get DATABASE_URL -a running-tree-4822`

More detailed instructions are on Heroku's web site:

https://devcenter.heroku.com/articles/heroku-postgresql#sharing-heroku-postgres-between-applications

Upvotes: 4

friism
friism

Reputation: 19279

I think the answer to the question you reference is still relevant. There's also a blog post with more details here.

Upvotes: 0

Related Questions