-- 回滚：恢复 Carrier 表的 channel_name、channel_code 字段

-- 添加 channel_name 字段
ALTER TABLE tb_carrier ADD COLUMN channel_name VARCHAR(100);
COMMENT ON COLUMN tb_carrier.channel_name IS '渠道名称';

-- 添加 channel_code 字段
ALTER TABLE tb_carrier ADD COLUMN channel_code VARCHAR(50);
COMMENT ON COLUMN tb_carrier.channel_code IS '渠道编码';

-- 重建联合唯一索引（carrier_type + channel_code，排除已删除记录）
CREATE UNIQUE INDEX idx_carrier_type_channel ON tb_carrier(carrier_type, channel_code) WHERE deleted_at IS NULL;
