fix repeatable migrations
This commit is contained in:
38
db/routines/R__048_fn_telemetry_heat_pump_sample.sql
Normal file
38
db/routines/R__048_fn_telemetry_heat_pump_sample.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
create or replace function ems.fn_telemetry_heat_pump_sample(
|
||||
p_site_id int,
|
||||
p_heat_pump_id int,
|
||||
p_measured_at timestamptz,
|
||||
p_power_w int,
|
||||
p_outdoor_temp_c double precision,
|
||||
p_water_outlet_temp_c double precision,
|
||||
p_tuv_tank_temp_c double precision,
|
||||
p_operating_mode text
|
||||
)
|
||||
returns void
|
||||
language sql
|
||||
as $fn$
|
||||
insert into ems.telemetry_heat_pump (
|
||||
site_id,
|
||||
heat_pump_id,
|
||||
measured_at,
|
||||
power_w,
|
||||
outdoor_temp_c,
|
||||
water_outlet_temp_c,
|
||||
tuv_tank_temp_c,
|
||||
operating_mode
|
||||
)
|
||||
values (
|
||||
p_site_id,
|
||||
p_heat_pump_id,
|
||||
p_measured_at,
|
||||
p_power_w,
|
||||
p_outdoor_temp_c,
|
||||
p_water_outlet_temp_c,
|
||||
p_tuv_tank_temp_c,
|
||||
p_operating_mode
|
||||
)
|
||||
on conflict (heat_pump_id, measured_at) do nothing;
|
||||
$fn$;
|
||||
|
||||
comment on function ems.fn_telemetry_heat_pump_sample is
|
||||
'Insert telemetrie TČ (placeholder Modbus).';
|
||||
Reference in New Issue
Block a user