Fix a long standing bug in new schema migration

... and make the test that uncovered it explicitly fail (there was already a
TODO) instead of passing but with errors logged
This commit is contained in:
Stu Tomlinson 2023-01-21 14:22:52 +00:00
parent cbbf85c555
commit 0c1cf43519
3 changed files with 5 additions and 4 deletions

View File

@ -92,7 +92,7 @@
-- DROP INDEX i_vcard_search_lemail;
-- DROP INDEX i_vcard_search_lorgname;
-- DROP INDEX i_vcard_search_lorgunit;
-- ALTER TABLE vcard_search ADD PRIMARY KEY (server_host, username);
-- ALTER TABLE vcard_search ADD PRIMARY KEY (server_host, lusername);
-- CREATE INDEX i_vcard_search_sh_lfn ON vcard_search(server_host, lfn);
-- CREATE INDEX i_vcard_search_sh_lfamily ON vcard_search(server_host, lfamily);
-- CREATE INDEX i_vcard_search_sh_lgiven ON vcard_search(server_host, lgiven);

View File

@ -246,7 +246,7 @@ update_tables(State) ->
drop_index(State, "vcard_search", "i_vcard_search_lemail"),
drop_index(State, "vcard_search", "i_vcard_search_lorgname"),
drop_index(State, "vcard_search", "i_vcard_search_lorgunit"),
add_pkey(State, "vcard_search", ["server_host", "username"]),
add_pkey(State, "vcard_search", ["server_host", "lusername"]),
create_index(State, "vcard_search", "i_vcard_search_sh_lfn", ["server_host", "lfn"]),
create_index(State, "vcard_search", "i_vcard_search_sh_lfamily", ["server_host", "lfamily"]),
create_index(State, "vcard_search", "i_vcard_search_sh_lgiven", ["server_host", "lgiven"]),

View File

@ -31,6 +31,7 @@
recv_presence/1, recv/1]).
-include("suite.hrl").
-include_lib("stdlib/include/assert.hrl").
%%%===================================================================
%%% API
@ -83,9 +84,9 @@ get_set(Config) ->
"personal website: http://www.saint-andre.com/">>},
#iq{type = result, sub_els = []} =
send_recv(Config, #iq{type = set, sub_els = [VCard]}),
%% TODO: check if VCard == VCard1.
#iq{type = result, sub_els = [_VCard1]} =
#iq{type = result, sub_els = [VCard1]} =
send_recv(Config, #iq{type = get, sub_els = [#vcard_temp{}]}),
?assertEqual(VCard, VCard1),
disconnect(Config).
service_vcard(Config) ->