mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-22 01:25:39 -05:00
Record last time an environmental device reported
This commit is contained in:
7
Environment/Service/Data/Queries/GetDevice.psql
Normal file
7
Environment/Service/Data/Queries/GetDevice.psql
Normal file
@@ -0,0 +1,7 @@
|
||||
SELECT
|
||||
name AS Name,
|
||||
last_updated AS LastUpdated
|
||||
FROM
|
||||
device
|
||||
WHERE
|
||||
name = @Name
|
||||
5
Environment/Service/Data/Queries/GetDevices.psql
Normal file
5
Environment/Service/Data/Queries/GetDevices.psql
Normal file
@@ -0,0 +1,5 @@
|
||||
SELECT
|
||||
name AS Name,
|
||||
last_updated AS LastUpdated
|
||||
FROM
|
||||
device
|
||||
11
Environment/Service/Data/Queries/SetDeviceLastUpdated.psql
Normal file
11
Environment/Service/Data/Queries/SetDeviceLastUpdated.psql
Normal file
@@ -0,0 +1,11 @@
|
||||
INSERT INTO device(
|
||||
name,
|
||||
last_updated
|
||||
)
|
||||
VALUES (
|
||||
@Name,
|
||||
@LastUpdated
|
||||
)
|
||||
ON CONFLICT (name)
|
||||
DO UPDATE
|
||||
SET last_updated = EXCLUDED.last_updated
|
||||
Reference in New Issue
Block a user