From 83ec14a8328dddad2b2cd52ec802542318c59354 Mon Sep 17 00:00:00 2001 From: patorash Date: Thu, 29 Aug 2024 16:37:13 +0900 Subject: [PATCH] Fix to specify 'postgres' as the database when checking for database existence --- lib/hanami/cli/commands/app/db/utils/postgres.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hanami/cli/commands/app/db/utils/postgres.rb b/lib/hanami/cli/commands/app/db/utils/postgres.rb index 0f469536..68d5dbae 100644 --- a/lib/hanami/cli/commands/app/db/utils/postgres.rb +++ b/lib/hanami/cli/commands/app/db/utils/postgres.rb @@ -14,7 +14,7 @@ module Utils class Postgres < Database # @api private def create_command - existing_stdout, status = Open3.capture2(cli_env_vars, "psql -t -c '\\l #{escaped_name}'") + existing_stdout, status = Open3.capture2(cli_env_vars.merge("PGDATABASE" => "postgres"), "psql -t -c '\\l #{escaped_name}'") return true if status.success? && existing_stdout.include?(escaped_name)