Files
HomeMonitor/Environment/Service/Data/Queries/SetDeviceLastUpdated.psql

16 lines
307 B
Plaintext

INSERT INTO device(
name,
last_updated,
stopped_reporting
)
VALUES (
@Name,
@LastUpdated,
false
)
ON CONFLICT (name)
DO UPDATE
SET last_updated = EXCLUDED.last_updated,
stopped_reporting = false
RETURNING
(SELECT stopped_reporting FROM device WHERE name = @Name);