Files
junhong_cmp_fiber/scripts/migration/rm.sql
Break e56649e5be
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 53s
还有例子
2026-06-12 18:10:37 +08:00

26 lines
758 B
SQL

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;