mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix handling of mqtt_pub table definition from mysql.sql and fix should_update_schema/1 in ejabberd_sql_schema.erl
This commit is contained in:
parent
66a08b6f18
commit
cb49fcf459
@ -293,6 +293,7 @@ string_to_type(SType) ->
|
||||
<<"integer">> -> integer;
|
||||
<<"int">> -> integer;
|
||||
<<"int(", _/binary>> -> integer;
|
||||
<<"int ", _/binary>> -> integer;
|
||||
<<"smallint">> -> smallint;
|
||||
<<"smallint(", _/binary>> -> smallint;
|
||||
<<"numeric">> -> numeric;
|
||||
@ -300,6 +301,7 @@ string_to_type(SType) ->
|
||||
<<"bigserial">> -> bigserial;
|
||||
<<"boolean">> -> boolean;
|
||||
<<"tinyint(1)">> -> boolean;
|
||||
<<"tinyint", _/binary>> -> smallint;
|
||||
<<"bytea">> -> blob;
|
||||
<<"blob">> -> blob;
|
||||
<<"timestamp", _/binary>> -> timestamp;
|
||||
@ -340,6 +342,8 @@ check_columns_compatibility(RequiredColumns, Columns) ->
|
||||
{integer, bigint} -> true;
|
||||
{integer, numeric} -> true;
|
||||
{bigint, numeric} -> true;
|
||||
%% a workaround for MySQL definition of mqtt_pub
|
||||
{bigint, integer} -> true;
|
||||
{bigserial, integer} -> true;
|
||||
{bigserial, bigint} -> true;
|
||||
{bigserial, numeric} -> true;
|
||||
@ -768,7 +772,17 @@ should_update_schema(Host) ->
|
||||
true ->
|
||||
case ejabberd_sql:use_new_schema() of
|
||||
true ->
|
||||
Host == ejabberd_config:get_myname();
|
||||
%% TODO: not efficient when there are many hosts
|
||||
case lists:search(
|
||||
fun(H) ->
|
||||
lists:member(
|
||||
sql, ejabberd_option:auth_method(H))
|
||||
end, ejabberd_option:hosts()) of
|
||||
{value, Host} ->
|
||||
true;
|
||||
_ ->
|
||||
false
|
||||
end;
|
||||
false ->
|
||||
true
|
||||
end;
|
||||
|
@ -58,7 +58,7 @@ sql_schemas() ->
|
||||
#sql_column{name = <<"content_type">>, type = text},
|
||||
#sql_column{name = <<"response_topic">>, type = text},
|
||||
#sql_column{name = <<"correlation_data">>, type = blob},
|
||||
#sql_column{name = <<"user_property">>, type = blob},
|
||||
#sql_column{name = <<"user_properties">>, type = blob},
|
||||
#sql_column{name = <<"expiry">>, type = bigint}],
|
||||
indices = [#sql_index{
|
||||
columns = [<<"topic">>, <<"server_host">>],
|
||||
|
Loading…
Reference in New Issue
Block a user