Skip to content

Commit

Permalink
Fix a long standing bug in new schema migration
Browse files Browse the repository at this point in the history
... and make the test that uncovered it explicitly fail (there was already a
TODO) instead of passing but with errors logged
  • Loading branch information
nosnilmot committed Jan 21, 2023
1 parent cbbf85c commit 0c1cf43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sql/pg.new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/mod_admin_update_sql.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Expand Down
5 changes: 3 additions & 2 deletions test/vcard_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
recv_presence/1, recv/1]).

-include("suite.hrl").
-include_lib("stdlib/include/assert.hrl").

%%%===================================================================
%%% API
Expand Down Expand Up @@ -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) ->
Expand Down

0 comments on commit 0c1cf43

Please sign in to comment.