-- Jednorázové potvrzení odeslání fatálního Discord alertu plán vs. skutečnost (deduplikace po slotu). create table ems.plan_fatal_deviation_sent ( site_id int not null references ems.site (id), interval_start timestamptz not null, reason_code text not null, sent_at timestamptz not null default now(), primary key (site_id, interval_start) ); create index idx_plan_fatal_deviation_sent_sent_at on ems.plan_fatal_deviation_sent (sent_at desc); comment on table ems.plan_fatal_deviation_sent is 'Backend job po uzavření 15min slotu: při fatální odchylce grid plán vs. audit jednou pošle Discord a zapíše řádek (PK site_id + interval_start).'; comment on column ems.plan_fatal_deviation_sent.reason_code is 'Kód z ems.fn_plan_actual_slot_guard_site (např. GRID_SIGN_MISMATCH, GRID_EXPORT_SPIKE).';