feat: authoritative plugin fields

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2026-01-24 16:19:27 +11:00
parent 49e689f022
commit be381488aa
10 changed files with 477 additions and 595 deletions

View File

@@ -171,6 +171,27 @@ def ensure_views(sql) -> bool:
EVE1.eve_PairEventRowID IS NULL;
""")
sql.execute(""" DROP VIEW IF EXISTS LatestDeviceScan;""")
sql.execute(""" CREATE VIEW LatestDeviceScan AS
WITH RankedScans AS (
SELECT
c.*,
ROW_NUMBER() OVER (
PARTITION BY c.cur_MAC, c.cur_ScanMethod
ORDER BY c.cur_DateTime DESC
) AS rn
FROM CurrentScan c
)
SELECT
d.*, -- all Device fields
r.* -- all CurrentScan fields (cur_*)
FROM Devices d
LEFT JOIN RankedScans r
ON d.devMac = r.cur_MAC
WHERE r.rn = 1;
""")
return True