-- A known failure heals itself, under a brake, and every repair is said (novox/hq to-be 45 §7, -- Phase 3, ADR 0227 rule 7). -- -- Every act a healer takes is a row here, written before the act and finished after it: what the -- budgets and the mesh-wide brake count, and what `healers` reads back. In the store and not in a -- bucket on the bus, because the budget must outlive the controller — a controller restarting in a -- loop must not reset a healer's count each time — and because the bus's user list would have to -- grant a new bucket before the first heal could be counted. -- -- Numbered 0070, past 0069, while the consumer-retirement feature (ADR 0230) is built beside this one: -- a migration it adds takes 0069 if it merges first; one merged after this must be numbered above -- 0070, because the store refuses to run a lower number than one already run. create table heal ( id bigserial primary key, -- The healer's id in the registry: H1, H2, ... healer text not null, -- The condition it acted on, and the condition's kind. condition_key text not null, kind text not null, -- What its budget is counted against: the condition, a machine, a holder, a consumer. budget_key text not null, -- What it did, in the mesh's words. act text not null, -- 'acting' while the act runs; then 'acted', 'failed' or 'escalated' (a budget spent, said). outcome text not null default 'acting', said text not null default '', at timestamptz not null default now(), finished timestamptz, -- The lease epoch it acted under (to-be 45 §6); null where none was claimed. epoch bigint ); create index heal_at on heal (at); create index heal_budget on heal (healer, budget_key, at);