Skip to content

Commit

Permalink
Add even more debug lines
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed May 23, 2024
1 parent bac8ec8 commit d3e62dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ejabberd_sql_schema.erl
Original file line number Diff line number Diff line change
Expand Up @@ -764,32 +764,40 @@ create_tables(Host, Module, SchemaInfo, Schema) ->
store_version(Host, Module, Schema#sql_schema.version).

should_update_schema(Host) ->
?INFO_MSG("SQL Schema: should_update_schema for ~p?", [Host]), %+++
SupportedDB =
case ejabberd_option:sql_type(Host) of
pgsql -> true;
sqlite -> true;
mysql -> true;
_ -> false
end,
?INFO_MSG("SQL Schema: should_update_schema for ~p - 1 SupportedDb: ~p", [Host, SupportedDB]), %+++
case ejabberd_option:update_sql_schema() andalso SupportedDB of
true ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 2", [Host]), %+++
case ejabberd_sql:use_new_schema() of
true ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 3", [Host]), %+++
%% TODO: not efficient when there are many hosts
case lists:dropwhile(
fun(H) ->
not lists:member(
sql, ejabberd_option:auth_method(H))
end, ejabberd_option:hosts()) of
[Host | _] ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 4", [Host]), %+++
true;
_ ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 4 NO", [Host]), %+++
false
end;
false ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 3 NO", [Host]), %+++
true
end;
false ->
?INFO_MSG("SQL Schema: should_update_schema for ~p - 2 NO", [Host]), %+++
false
end.

Expand Down

0 comments on commit d3e62dc

Please sign in to comment.