Files
junhong_cmp_fiber/migrations/000021_carrier_remove_channel_fields.down.sql
huang d104d297ca
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m16s
feat: 实现运营商模块重构,添加冗余字段优化查询性能
主要变更:
- 新增 Carrier CRUD API(创建、列表、详情、更新、删除、状态更新)
- IotCard/IotCardImportTask 添加 carrier_type/carrier_name 冗余字段
- 移除 Carrier 表的 channel_name/channel_code 字段
- 查询时直接使用冗余字段,避免 JOIN Carrier 表
- 添加数据库迁移脚本(000021-000023)
- 添加单元测试和集成测试
- 同步更新 OpenAPI 文档和 specs
2026-01-27 12:18:19 +08:00

13 lines
573 B
SQL
Raw Permalink 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.
-- 回滚:恢复 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;