Update psql drop_command to force dropdb
Context:
The reason behind it is to improve developer experience, as right now when running a command like hanami db reset it will fail if the user has any other ongoing connection, like a connection to db client(like dbeaver), or a hanami console session.

Couple other possible approaches are:
# create a dedicated method for force drop
def force_drop_command
system(cli_env_vars, "dropdb --force #{escaped_name}")
end
# force as an option/param
def drop_command(force=false)
command_prefix = force ? "dropdb --force" : "dropdb"
system(cli_env_vars, "#{command_prefix} #{escaped_name}")
end
Reference: https://www.postgresql.org/docs/current/sql-dropdatabase.html#id-1.9.3.108.6
I don't think we should use force by default, but making it an option would be 👍
Hi @Andsbf! Thanks for this confibution :) Like @parndt suggested, I think this would work best as a --force option to the db drop command, rather than it being the default.
Would you mind adjusting this PR to turn it into an option? Thanks!
@parndt @timriley thanks for the follow up, I have updated the PR according to the conversation above, let me know if I got it right. I could not find document to update regard that interface change (making the Hanami::CLI::Commands::App::DB::Drop) take an optional value, so let me know if I miss it.
I would appreciate some help here on how to use it....given I have the following on my hanami file:
if this PR gets merged I would update my "db drop" register command to this?
Hanami::CLI.register "db drop", Hanami::CLI::Commands::App::DB::Drop.new(force: true)
also would the other commands "follow" on the "force" ? I mean, if I call "db reset" would it use the "db drop" with the force: true ? looking at this file I would assume it wouldn't:
https://github.com/hanami/cli/blob/main/lib/hanami/cli/commands/app/db/reset.rb
I highly appreciate you guys putting the time to look at this PR, thanks again!