CREATE TABLE IF NOT EXISTS mci_policy_group (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    tenant_code VARCHAR(64) NOT NULL COMMENT '所属租户',
    group_code VARCHAR(64) NOT NULL COMMENT '策略组编码',
    group_name VARCHAR(128) NOT NULL COMMENT '策略组名称',
    channel_type VARCHAR(32) COMMENT '渠道类型：wecom / wechat_personal / dingtalk / feishu',
    policies JSON NOT NULL COMMENT '策略规则 JSON',
    status TINYINT NOT NULL DEFAULT 1 COMMENT '状态：0禁用 1启用',
    create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deleted TINYINT NOT NULL DEFAULT 0,
    UNIQUE KEY uk_tenant_group_code (tenant_code, group_code, deleted),
    KEY idx_tenant_status (tenant_code, status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='策略组表';
