fix repeatable migrations

This commit is contained in:
Dusan Vojacek
2026-04-19 20:15:46 +02:00
parent 0c93f493a4
commit 22bca9cd9e
73 changed files with 22 additions and 15 deletions

View File

@@ -0,0 +1,16 @@
create or replace function ems.fn_deye_clock_drift_sec(
p_device_ts timestamptz,
p_reference_ts timestamptz
)
returns int
language sql
immutable
as $fn$
select case
when p_device_ts is null or p_reference_ts is null then null::int
else abs(extract(epoch from (p_device_ts - p_reference_ts)))::int
end;
$fn$;
comment on function ems.fn_deye_clock_drift_sec(timestamptz, timestamptz) is
'Absolutní odchylka hodin Deye vs referenční UTC (sekundy).';