You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do not set DATABASE_URL if scheme is unknown (heroku#1715)
* Add support for `trilogy` adapter
When using the trilogy gem if you fail to supply a `DATABASE_URL` env variable you'll get an invalid database URL with no scheme. I figure that adding this in the Rails3 class is OK rather than duplicate this in Rails7 or add a Rails71 for it.
* Do not set DATABASE_URL if scheme is unknown
Reported in heroku#1714 when using a database adapter such as `trilogy`, the application will fail to boot because an invalid DATABASE_URL is constructed (because the `trilogy` adapter is unknown):
```
remote: ensure you can run `$ bundle exec rake -P` against your app
remote: and using the production group of your Gemfile.
remote: rake aborted!
remote: URI::InvalidURIError: bad URI (is not URI?): ://user:pass@127.0.0.1/dbname (URI::InvalidURIError)
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/uri-1.1.1/lib/uri/rfc2396_parser.rb:176:in `split'
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/uri-1.1.1/lib/uri/rfc2396_parser.rb:209:in `parse'
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/activerecord-8.1.2/lib/active_record/database_configurations/connection_url_resolver.rb:27:in `initialize'
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/activerecord-8.1.2/lib/active_record/database_configurations/url_config.rb:83:in `new'
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/activerecord-8.1.2/lib/active_record/database_configurations/url_config.rb:83:in `build_url_hash'
remote: /tmp/build_b50909c5/vendor/bundle/ruby/3.3.0/gems/activerecord-8.1.2/lib/active_record/database_configurations/url_config.rb:44:in `initialize'
```
Rather than keeping track of all possible adapters we can guard against this case with Rails 4.1+ applications by having customers check in a `config/database.yml` https://devcenter.heroku.com/articles/rails-database-connection-behavior.
---------
Co-authored-by: Danny Fallon <danny.fallon.ie+github@gmail.com>
0 commit comments