fix(test): add mnesia secondary indexes in eh_test_support
CI / test (push) Failing after 9m25s
CI / deploy-ift (push) Has been skipped
CI / e2e-ift (push) Has been skipped
CI / deploy-stage (push) Has been skipped
CI / e2e-stage (push) Has been skipped

EUnit tables must mirror infra_mnesia:create_indices so dirty_index_read
paths in booking/event/search/user do not abort with badarg.
This commit is contained in:
2026-08-04 10:27:58 +03:00
parent 6c0775ee5e
commit 72bc440049
+25 -9
View File
@@ -72,18 +72,34 @@ stop_mnesia() ->
ensure_tables(Tables) when is_list(Tables) -> ensure_tables(Tables) when is_list(Tables) ->
lists:foreach(fun ensure_table/1, Tables), lists:foreach(fun ensure_table/1, Tables),
maybe_add_admin_stats_indexes(Tables), %% Mirror infra_mnesia:create_indices/0 for tables present in this suite.
ensure_indexes(Tables),
ok. ok.
maybe_add_admin_stats_indexes(Tables) -> %% Indexes required by core_*/logic_* dirty_index_read / index_read paths.
case lists:member(report, Tables) of ensure_indexes(Tables) when is_list(Tables) ->
true -> add_index(report, resolved_by); lists:foreach(fun({Tab, Attrs}) ->
case lists:member(Tab, Tables) of
true -> lists:foreach(fun(Attr) -> add_index(Tab, Attr) end, Attrs);
false -> ok false -> ok
end, end
case lists:member(ticket, Tables) of end, [
true -> add_index(ticket, assigned_to); {event, [calendar_id, title, created_at, start_time, event_type,
false -> ok master_id, specialist_id, status]},
end. {booking, [event_id, user_id, status]},
{review_vote, [review_id, user_id]},
{calendar, [owner_id, status, short_name, category]},
{calendar_specialist, [calendar_id, user_id]},
{specialist_invite, [calendar_id, invitee_user_id, invitee_email, token, status]},
{user, [nickname, email]},
{verification, [user_id]},
{password_reset, [user_id]},
{notification, [user_id, is_read]},
{auth_session, [family_id, subject_id]},
{report, [resolved_by]},
{ticket, [assigned_to]}
]),
ok.
add_index(Table, Attr) -> add_index(Table, Attr) ->
case catch mnesia:add_table_index(Table, Attr) of case catch mnesia:add_table_index(Table, Attr) of