herokuのドキュメントには以下のように書いてますが...
# PostgreSQL. Versions 9.3 and up are supported.
#
(中略)
production:
primary: &primary_production
<<: *default
database: myapp_production
username: myapp
password: <%= ENV["MYAPP_DATABASE_PASSWORD"] %>
cache:
<<: *primary_production
database: myapp_production_cache
migrations_paths: db/cache_migrate
queue:
<<: *primary_production
database: myapp_production_queue
migrations_paths: db/queue_migrate
cable:
<<: *primary_production
database: myapp_production_cable
migrations_paths: db/cable_migrate
これだと自分はうまくいかず、以下にするとうまくいきました
(user_name, passwordではなくurl: <%= ENV['DATABASE_URL'] %>に)
# PostgreSQL. Versions 9.3 and up are supported.
#
(中略)
production:
primary: &primary_production
<<: *default
database: myapp_production
url: <%= ENV['DATABASE_URL'] %>
cache:
<<: *primary_production
database: myapp_production_cache
migrations_paths: db/cache_migrate
queue:
<<: *primary_production
database: myapp_production_queue
migrations_paths: db/queue_migrate
cable:
<<: *primary_production
database: myapp_production_cable
migrations_paths: db/cable_migrate