fix 500
Some checks failed
CI and deploy / migration-check (push) Failing after 10s
CI and deploy / deploy (push) Has been skipped

This commit is contained in:
Dusan Vojacek
2026-04-20 11:11:47 +02:00
parent b8515f30df
commit a07f5d57cb
6 changed files with 94 additions and 27 deletions

View File

@@ -0,0 +1,22 @@
create or replace function ems.fn_update_heartbeat(
p_site_id int,
p_status text default 'ok',
p_ems_version text default null
)
returns void
language sql
as $$
insert into ems.site_heartbeat (site_id, last_seen, status, ems_version)
values (p_site_id, now(), p_status, p_ems_version)
on conflict (site_id) do update set
last_seen = now(),
status = excluded.status,
ems_version = coalesce(excluded.ems_version, ems.site_heartbeat.ems_version);
$$;
comment on function ems.fn_update_heartbeat(int, text, text) is
'Aktualizuje informační heartbeat záznam EMS pro danou lokalitu.
Volat každou minutu z backend service po úspěšném odeslání pulzu do Loxone.
Slouží pouze pro EMS dashboard Loxone watchdog nezávisí na této tabulce,
sleduje HTTP pulzy přímo a nezávisle na dostupnosti DB.';