还有例子
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 53s

This commit is contained in:
Break
2026-06-12 18:10:37 +08:00
parent 1c492fe8db
commit e56649e5be
9 changed files with 9587 additions and 0 deletions

25
scripts/migration/rm.sql Normal file
View File

@@ -0,0 +1,25 @@
WITH cards AS (
SELECT id
FROM tb_iot_card
WHERE created_at >= '2026-06-10 15:00:28'::timestamp
AND created_at < '2026-06-10 16:00:00'::timestamp
),
task_types(task_type) AS (
VALUES
('polling:realname'),
('polling:carddata'),
('polling:package'),
('polling:protect'),
('polling:card_status')
)
SELECT format('ZREM polling:shard:%s:queue:%s %s', id % 16, task_type, id)
FROM cards CROSS JOIN task_types
UNION ALL
SELECT format('DEL polling:card:%s', id)
FROM cards
UNION ALL
SELECT format('LREM polling:manual:%s 0 %s', task_type, id)
FROM cards CROSS JOIN task_types
UNION ALL
SELECT format('SREM polling:manual:dedupe:%s %s', task_type, id)
FROM cards CROSS JOIN task_types;