mirror of
https://github.com/valitydev/psql-migration.git
synced 2024-11-06 01:05:18 +00:00
Merge pull request #13 from davidszkiba/new-migration-failed-message
Show error if migration can not be created
This commit is contained in:
commit
c84b06fc7e
@ -65,8 +65,12 @@ handle_command({ok, {Args, ["new", Name]}}) ->
|
||||
"-- :down\n",
|
||||
"-- Down migration\n"
|
||||
],
|
||||
file:write_file(Filename, list_to_binary(C), [exclusive]),
|
||||
handle_command_result({ok, "Created migration: ~s~n", [Filename]});
|
||||
Result = case file:write_file(Filename, list_to_binary(C), [exclusive]) of
|
||||
ok -> {ok, "Created migration: ~s~n", [Filename]};
|
||||
{error, Reason} -> {error,
|
||||
"Migration can not be written to file ~s: ~s~n", [Filename, Reason]}
|
||||
end,
|
||||
handle_command_result(Result);
|
||||
handle_command({ok, {Args, ["run"]}}) ->
|
||||
Available = available_migrations(Args),
|
||||
Result = with_connection(
|
||||
|
Loading…
Reference in New Issue
Block a user