This commit is contained in:
hashbro
2026-09-16 22:41:11 +08:00
parent 93245d105e
commit a49fb2415d
+21
View File
@@ -0,0 +1,21 @@
-- One-shot: devices.created_at on/after Sep 17 still +8h (missed by 14:00 cutoff).
-- Do not re-run the previous shift-old-datetimes script.
SET time_zone = '+08:00';
SET @from = '2026-09-17 00:00:00';
SELECT COUNT(*) AS n, MIN(created_at) AS mn, MAX(created_at) AS mx
FROM devices
WHERE created_at IS NOT NULL AND created_at >= @from;
UPDATE devices
SET created_at = DATE_SUB(created_at, INTERVAL 8 HOUR)
WHERE created_at IS NOT NULL AND created_at >= @from;
SELECT ROW_COUNT() AS created_at_updated;
SELECT id, device_id, created_at, updated_at
FROM devices
WHERE created_at IS NOT NULL
ORDER BY created_at DESC
LIMIT 5;