1
0
mirror of https://github.com/UzixLS/migresia.git synced 2025-07-19 07:11:28 +03:00

Changing out to use disc_copies everywhere for consistency; also making it so that code is loaded on all nodes so that transforms will work.

This commit is contained in:
Christopher Phillips
2013-11-21 11:36:54 -05:00
parent 7a60739ac5
commit 9ba7b9189b

View File

@ -58,6 +58,7 @@ migrate(App) ->
ok ->
case migresia_migrations:ensure_schema_table_exists() of
ok ->
rpc:multicall(migresia_migrations, list_unapplied_ups, [App]), %Basically just to ensure everybody has loaded all the migrations, which is necessary in distributed Mnesia transforms.
Loaded = migresia_migrations:list_unapplied_ups(App),
lists:foreach(fun execute_up/1, Loaded);
{error, Error} -> Error
@ -81,7 +82,7 @@ start_mnesia(RemoteToo) ->
ok ->
case RemoteToo of
false -> ok;
true -> {ResultList, BadNodes} = rpc:multicall(list_all_nodes(), application, ensure_started, [mnesia]),
true -> {ResultList, BadNodes} = rpc:multicall(list_disc_copy_nodes(), application, ensure_started, [mnesia]),
BadStatuses = [X || X <- ResultList, X /= ok],
if BadNodes /= [] -> io:format(" => Error:~p~n", [not_all_nodes_running]), {error, not_all_nodes_running};
BadStatuses /= [] -> io:format(" => Error:~p~n", [BadStatuses]), {error, BadStatuses};
@ -90,8 +91,5 @@ start_mnesia(RemoteToo) ->
end
end.
list_all_nodes() ->
mnesia:table_info(schema, all_nodes).
list_disc_copy_nodes() ->
mnesia:table_info(schema, disc_copies).