Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Either always force psql drop or allow force as option #82

Open
Andsbf opened this issue Apr 4, 2023 · 0 comments
Open

Either always force psql drop or allow force as option #82

Andsbf opened this issue Apr 4, 2023 · 0 comments

Comments

@Andsbf
Copy link
Contributor

Andsbf commented Apr 4, 2023

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.

image

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 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

PR with proposal:
#81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant