Default to postgres database for creation context

This commit is contained in:
Marc Nijdam 2020-01-10 09:57:43 -07:00
parent c27f4157be
commit 2c6fd73617
No known key found for this signature in database
GPG Key ID: 1C84AFC593B1B79D

View File

@ -95,7 +95,7 @@ handle_command({ok, {Args, ["reset"]}}) ->
error ->
handle_command_result({error, "No database to reset~n"});
{Database, Opts1} ->
case with_connection(Opts1,
case with_connection(Opts1#{database => "postgres"},
fun(Conn) ->
if_ok(epgsql:squery(Conn, "drop database if exists " ++ Database))
end) of
@ -111,7 +111,7 @@ handle_command({ok, {Args, ["setup"]}}) ->
error ->
handle_command_result({error, "No database to reset~n"});
{Database, Opts1} ->
case with_connection(Opts1,
case with_connection(Opts1#{database => "postgres"},
fun(Conn) ->
if_ok(epgsql:squery(Conn, "create database " ++ Database))
end) of