Initial commit of akmon project

This commit is contained in:
2026-01-20 08:04:15 +08:00
commit 77a2bab985
1309 changed files with 343305 additions and 0 deletions

14
update_null_watch_ids.sql Normal file
View File

@@ -0,0 +1,14 @@
-- 为 watch_id 为 NULL 的设备分配 900-1000 之间的唯一 ID
-- 注意:此脚本假设 900-1000 范围内没有被现有设备占用
-- 仅更新最多 101 条记录,以防超出范围
WITH target_devices AS (
SELECT id, ROW_NUMBER() OVER (ORDER BY bind_time ASC) as rn
FROM public.ak_devices
WHERE watch_id IS NULL
LIMIT 101 -- 900到1000共101个数字
)
UPDATE public.ak_devices
SET watch_id = 899 + target_devices.rn
FROM target_devices
WHERE public.ak_devices.id = target_devices.id;