Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the significance when a Heroku database URL is called 'HEROKU_POSTGRESQL_WHITE_URL'?

What's the "significance" - if any - when a database URL is called HEROKU_POSTGRESQL_WHITE_URL? I've seen other names in Heroku's documentation such as 'HEROKU_POSTGRESQL_PURPLE_URL', HEROKU_POSTGRESQL_CHARCOAL_URL,...

Does it mean it's always your primary database, or first database to be provision? I would love to know.

$ heroku pg:info
=== HEROKU_POSTGRESQL_WHITE_URL (DATABASE_URL)
Plan:               Standard 0
Status:             Available
Data Size:          491.9 MB
Tables:             22
PG Version:         9.3.5
....
like image 981
user1322092 Avatar asked Apr 24 '15 22:04

user1322092


1 Answers

Colors are picked randomly and exist uniquely in the scope of the application the database was created on. Across multiple applications, colors have no meaning or correlation.

By example, you can have 2 applications with 4 distinct databases using only 3 colors:

  • my_awesome_application
    • HEROKU_POSTGRESQL_WHITE_URL
    • HEROKU_POSTGRESQL_RED_URL
  • my_other_thing
    • HEROKU_POSTGRESQL_BLUE_URL
    • HEROKU_POSTGRESQL_WHITE_URL

The color in db:info marked (DATABASE_URL) is the one your application is connecting to (unless you've configured something else). If you look at heroku config, you'll see something like

HEROKU_POSTGRESQL_WHITE_URL=postgres://path.to:a/db
DATABASE_URL=<the same value WHITE has>

If you've provisioned other databases on the same app, like followers, you'll see more colors in config with different URLs. If they're followers, pg:info tells you which DB they're following.

like image 126
Kristján Avatar answered Nov 02 '22 18:11

Kristján