feat(archive): month snapshots on the same node, drop extra-node and HTML /view.
CI / test (push) Failing after 41m15s
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

Fixes EventHub/EventHubBack#76

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-17 14:59:30 +03:00
parent ef31e7fb40
commit e3f5a7ca13
25 changed files with 501 additions and 667 deletions
@@ -0,0 +1,41 @@
%% @doc month_snapshot table (Back#76). disc_only — blobs not in RAM.
-module('20260817140000_month_snapshot').
-export([up/0, down/0]).
-include("records.hrl").
up() ->
ensure_table(),
ensure_index(month_snapshot, calendar_id),
ensure_index(month_snapshot, year_month),
ok.
down() ->
_ = mnesia:delete_table(month_snapshot),
ok.
ensure_table() ->
case lists:member(month_snapshot, mnesia:system_info(tables)) of
true ->
ok;
false ->
Attrs = record_info(fields, month_snapshot),
case mnesia:create_table(month_snapshot, [
{disc_only_copies, [node()]},
{attributes, Attrs}
]) of
{atomic, ok} -> ok;
{aborted, {already_exists, month_snapshot}} -> ok;
{aborted, Reason} -> error({create_table_failed, month_snapshot, Reason})
end
end.
ensure_index(Table, Attr) ->
case mnesia:add_table_index(Table, Attr) of
{atomic, ok} -> ok;
{aborted, {already_exists, Table, _Pos}} -> ok;
{aborted, {already_exists, Table, Attr}} -> ok;
{aborted, {already_exists, _}} -> ok;
{aborted, Reason} -> error({add_index_failed, Table, Attr, Reason})
end.