In your applications, you should be using the DATABASE_URL
configuration variable to connect to your database. It's not an uncommon occurrence, especially when upgrading a database to have multiple databases for a single application. Heroku makes it easy for us to manage which database's credentials are assigned to DATABASE_URL
through a process known as promotion. At any time, you can promote any database assigned to your application and make it primary by updating DATABASE_URL
. This makes it simple to swap databases without any risk of pasting incorrect credentials.
To start, let's open up a terminal and take a look at our current configuration variables:
Let's run
heroku config
to view our existing settings:$ heroku config DATABASE_URL: postgres://user:[email protected]:5432/d8hg98vjvtisu4 HEROKU_POSTGRESQL_GRAY_URL: postgres://user:[email protected]:5792/d75vuqlr37fe HEROKU_POSTGRESQL_ORANGE_URL...