Files
junhong_cmp_fiber/migrations/archive/000046_create_tb_polling_config.up.sql

45 lines
2.1 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.
-- 轮询配置表
-- 先删除旧表(如果存在)
DROP TABLE IF EXISTS tb_polling_config CASCADE;
CREATE TABLE tb_polling_config (
id BIGSERIAL PRIMARY KEY,
config_name VARCHAR(100) NOT NULL,
card_condition VARCHAR(50),
card_category VARCHAR(50),
carrier_id BIGINT,
priority INT NOT NULL DEFAULT 100,
realname_check_interval INT,
carddata_check_interval INT,
package_check_interval INT,
status SMALLINT NOT NULL DEFAULT 1,
description TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
created_by BIGINT,
updated_by BIGINT
);
-- 索引
CREATE INDEX idx_polling_config_status_priority ON tb_polling_config(status, priority);
CREATE INDEX idx_polling_config_carrier_id ON tb_polling_config(carrier_id);
-- 表注释
COMMENT ON TABLE tb_polling_config IS '轮询配置表 - 定义不同条件下的卡轮询策略';
-- 列注释
COMMENT ON COLUMN tb_polling_config.config_name IS '配置名称';
COMMENT ON COLUMN tb_polling_config.card_condition IS '卡状态条件not_real_name/real_name/activated/suspended';
COMMENT ON COLUMN tb_polling_config.card_category IS '卡业务类型normal/industry';
COMMENT ON COLUMN tb_polling_config.carrier_id IS '运营商ID可选精确匹配';
COMMENT ON COLUMN tb_polling_config.priority IS '优先级(数字越小优先级越高)';
COMMENT ON COLUMN tb_polling_config.realname_check_interval IS '实名检查间隔NULL表示不检查';
COMMENT ON COLUMN tb_polling_config.carddata_check_interval IS '流量检查间隔NULL表示不检查';
COMMENT ON COLUMN tb_polling_config.package_check_interval IS '套餐检查间隔NULL表示不检查';
COMMENT ON COLUMN tb_polling_config.status IS '状态0-禁用1-启用';
COMMENT ON COLUMN tb_polling_config.description IS '配置说明';
COMMENT ON COLUMN tb_polling_config.created_at IS '创建时间';
COMMENT ON COLUMN tb_polling_config.updated_at IS '更新时间';
COMMENT ON COLUMN tb_polling_config.created_by IS '创建人ID';
COMMENT ON COLUMN tb_polling_config.updated_by IS '更新人ID';