platformsh / platformify

Get your project ready to be deployed in Platform.sh
MIT License
3 stars 9 forks source link

Override DB_CONNECTION for Ruby adaptor name #195

Closed spk closed 10 months ago

spk commented 10 months ago

why

Ruby on Rails adapter name can be different from the protocol connection resulting on error like:

I, [2023-09-27T10:32:25.076395 #370]  INFO -- : Refreshing Gem list                                                                                                          
bundler: failed to load command: unicorn (/app/vendor/bundle/ruby/3.2.0/bin/unicorn)                                                                                         
/app/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require': Could not load the 'pgsql' Active Record adapter.
Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile. (LoadError)

Trilogy is not widely used yet https://github.blog/2022-08-25-introducing-trilogy-a-new-database-adapter-for-ruby-on-rails/

More info

how

Override DB_CONNECTION for those adapter

akalipetis commented 10 months ago

@spk I simplified the code a bit and removed the mysql2 change, since it's not required and it's Ruby-specific. Also, added the implementation to Upsun as well.

If you believe we should use the mysql2 change as well, let's first discuss this in an issue.

Thanks a lot for the contribution! 🎉