重构: 将卡/设备的套餐系列绑定从分配ID改为系列ID
- 数据库: 重命名 series_allocation_id → series_id - Model: IotCard 和 Device 字段重命名 - DTO: 所有请求/响应字段统一为 series_id - Store: 方法重命名,新增 GetByShopAndSeries 查询 - Service: 业务逻辑优化,系列验证和权限验证分离 - 测试: 更新所有测试用例,新增 shop_series_allocation_store_test.go - 文档: 更新 API 文档说明参数变更 BREAKING CHANGE: API 参数从 series_allocation_id 改为 series_id
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
-- 回滚: 将 series_id 改回 series_allocation_id
|
||||
ALTER TABLE tb_iot_card RENAME COLUMN series_id TO series_allocation_id;
|
||||
COMMENT ON COLUMN tb_iot_card.series_allocation_id IS '套餐系列分配ID(关联ShopSeriesAllocation)';
|
||||
|
||||
ALTER TABLE tb_device RENAME COLUMN series_id TO series_allocation_id;
|
||||
COMMENT ON COLUMN tb_device.series_allocation_id IS '套餐系列分配ID(关联ShopSeriesAllocation)';
|
||||
|
||||
-- 删除索引(如果存在)
|
||||
DROP INDEX IF EXISTS idx_shop_series_allocation_shop_series;
|
||||
@@ -0,0 +1,13 @@
|
||||
-- 重构: 将卡/设备的套餐系列绑定从分配ID改为系列ID
|
||||
-- 重命名 tb_iot_card.series_allocation_id 为 series_id
|
||||
ALTER TABLE tb_iot_card RENAME COLUMN series_allocation_id TO series_id;
|
||||
COMMENT ON COLUMN tb_iot_card.series_id IS '套餐系列ID(关联PackageSeries)';
|
||||
|
||||
-- 重命名 tb_device.series_allocation_id 为 series_id
|
||||
ALTER TABLE tb_device RENAME COLUMN series_allocation_id TO series_id;
|
||||
COMMENT ON COLUMN tb_device.series_id IS '套餐系列ID(关联PackageSeries)';
|
||||
|
||||
-- 验证并添加复合索引(如果不存在)
|
||||
CREATE INDEX IF NOT EXISTS idx_shop_series_allocation_shop_series
|
||||
ON tb_shop_series_allocation(shop_id, series_id)
|
||||
WHERE status = 1;
|
||||
Reference in New Issue
Block a user