Files
junhong_cmp_fiber/migrations/000050_create_tb_data_cleanup_config.up.sql
huang 931e140e8e
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m35s
feat: 实现 IoT 卡轮询系统(支持千万级卡规模)
实现功能:
- 实名状态检查轮询(可配置间隔)
- 卡流量检查轮询(支持跨月流量追踪)
- 套餐检查与超额自动停机
- 分布式并发控制(Redis 信号量)
- 手动触发轮询(单卡/批量/条件筛选)
- 数据清理配置与执行
- 告警规则与历史记录
- 实时监控统计(队列/性能/并发)

性能优化:
- Redis 缓存卡信息,减少 DB 查询
- Pipeline 批量写入 Redis
- 异步流量记录写入
- 渐进式初始化(10万卡/批)

压测工具(scripts/benchmark/):
- Mock Gateway 模拟上游服务
- 测试卡生成器
- 配置初始化脚本
- 实时监控脚本

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 17:32:44 +08:00

29 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 数据清理配置表
CREATE TABLE IF NOT EXISTS tb_data_cleanup_config (
id BIGSERIAL PRIMARY KEY,
table_name VARCHAR(100) NOT NULL UNIQUE,
retention_days INT NOT NULL,
enabled SMALLINT NOT NULL DEFAULT 1,
batch_size INT NOT NULL DEFAULT 10000,
description TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_by BIGINT
);
-- 索引
CREATE INDEX idx_data_cleanup_config_enabled ON tb_data_cleanup_config(enabled);
-- 表注释
COMMENT ON TABLE tb_data_cleanup_config IS '数据清理配置表 - 定义各表的数据保留策略';
-- 列注释
COMMENT ON COLUMN tb_data_cleanup_config.table_name IS '表名';
COMMENT ON COLUMN tb_data_cleanup_config.retention_days IS '保留天数';
COMMENT ON COLUMN tb_data_cleanup_config.enabled IS '是否启用0-禁用1-启用';
COMMENT ON COLUMN tb_data_cleanup_config.batch_size IS '每批删除条数';
COMMENT ON COLUMN tb_data_cleanup_config.description IS '配置说明';
COMMENT ON COLUMN tb_data_cleanup_config.created_at IS '创建时间';
COMMENT ON COLUMN tb_data_cleanup_config.updated_at IS '更新时间';
COMMENT ON COLUMN tb_data_cleanup_config.updated_by IS '更新人ID';