cli icon indicating copy to clipboard operation
cli copied to clipboard

Fail `hanami db drop` when cannot check database existence

Open katafrakt opened this issue 1 year ago • 0 comments

Currently if the existence check for a database fails (for example due to whole database server being down or user not existing), Hanami CLI will anyway return information that the database was dropped.

This changes it to failing with an explicit error message in such case. Examples:

$ hanami db drop
Could not check if the database exists. Error message:
psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
	Is the server running on that host and accepting TCP/IP connections?
$ hanami db drop
Could not check if the database exists. Error message:
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  database "katafrakt" does not exist

Addresses #275

katafrakt avatar Dec 11 '24 21:12 katafrakt