PKGBUILD/pkg/repository/db/sqlite3/dml/insertOrUpdateSensor.sql

32 lines
797 B
MySQL
Raw Normal View History

INSERT INTO sensors (
sensor_id,
sensor_name,
sensor_location,
wire_id,
i2c_bus,
i2c_address,
gpio_number,
sensor_model,
sensor_enabled,
tick_duration,
device_id,
creation_date,
update_date
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
ON CONFLICT (sensor_id)
DO
UPDATE SET
sensor_name = EXCLUDED.sensor_name,
sensor_location = EXCLUDED.sensor_location,
wire_id = EXCLUDED.wire_id,
i2c_bus = EXCLUDED.i2c_bus,
i2c_address = EXCLUDED.i2c_address,
gpio_number = EXCLUDED.gpio_number,
sensor_model = EXCLUDED.sensor_model,
sensor_enabled = EXCLUDED.sensor_enabled,
tick_duration = EXCLUDED.tick_duration,
device_id = EXCLUDED.device_id,
creation_date = EXCLUDED.creation_date,
update_date = date('now');