TalentBox / sequel-rails

A gem for using Sequel with Rails 5.x, 6.x, 7.x
http://talentbox.github.io/sequel-rails/
MIT License
324 stars 81 forks source link

Fix database_create_command? check #190

Closed tycooon closed 2 years ago

tycooon commented 2 years ago

Currently this check doesn't work with rails db:create command since rails replaces ARGV. This fix makes it work for both rails and rake versions.

JonathanTron commented 2 years ago

Hi @tycooon the change looks good. Thanks for taking the time to open the PR!

tycooon commented 2 years ago

Thank you!

By the way, I found this issue while working on adding Sequel support for rails dbconsole command. It looks like Rails commands are not very extendable, but I found some monkey-patchey way to make it work (only for pg for now).

You can find a draft of the code here https://github.com/umbrellio/umbrellio-sequel-plugins/blob/add-console-task/lib/umbrellio_sequel_plugins/rails_db_command.rb. This file should be required in Rails boot.rb file since it patches the Rails::Command::DbconsoleCommand class :(

Would you be intrested in supporting this feature in this gem?