From f793203e043aaa2db38823c84500e82756348ac0 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 17 Jul 2025 18:45:43 +0300 Subject: Added session duration metrics with device analytics along with device analytics metrics in the DB to aggregate and DeviceID abuse prevention --- query/device_analytics.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 query/device_analytics.sql (limited to 'query') diff --git a/query/device_analytics.sql b/query/device_analytics.sql new file mode 100644 index 0000000..92287af --- /dev/null +++ b/query/device_analytics.sql @@ -0,0 +1,11 @@ +-- name: SetDeviceAnalytics :one +INSERT INTO device_analytics ( + device_id, os, arch, term, colorterm +) VALUES ( + @device_id, @os, @arch, @term, @colorterm +) +ON CONFLICT DO +UPDATE SET + os = EXCLUDED.os, arch = EXCLUDED.arch, term = EXCLUDED.term, colorterm = EXCLUDED.colorterm +WHERE device_id = EXCLUDED.device_id +RETURNING *; -- cgit v1.3.1