I recently tried VERY hard to override the database configuration bassed on
ENV vars or actual API calls. This task is almost next to impossible.
I know that the database.yml file is parsed as ERB but that is sane for
simple ENV replacement if you want to actually change which database adaptor
it is (requires extra config/params) it becomes messy.
Active record supports this natively, I can't see why rails would force the
requirement of a database.yml and for it to have a "production" section. see
establish_connection (ActiveRecord::Base) - APIdock URL
section.
But that doesn't help the problem in #5297. The problem in #5297 is
that Heroku calculates it's own parameters to pass in for the URL.
AFAIK, there is no way to augment the connection parameters that Heroku
sends. But this seems like an issue with Heroku rather than Rails.
If you find entry points where the environment variable *isn't* used,
then we should consider it a bug. For example, I just discovered that
`rake db:schema:dump` will not use the environment variable: