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

假如想象 提交于 2020-06-11 22:58:46

问题


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
....

回答1:


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.



来源:https://stackoverflow.com/questions/29858588/whats-the-significance-when-a-heroku-database-url-is-called-heroku-postgresql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!