Files
junhong_cmp_fiber/scripts/migration/config/mapping.yaml.example
Break 58863e8ec5
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 54s
数据迁移脚本
2026-05-27 11:10:56 +08:00

48 lines
2.3 KiB
Plaintext
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.
# 奇成迁移映射配置(单文件)
# 复制为 mapping.yaml 后使用,会被 scan_legacy.py 自动增量补全
#
# 工作流:
# 1. 业务方提供 resources/cards.csv(只需 iccid 列)
# 2. python3 scan_legacy.py → 自动从奇成扫描元数据,把发现的 carrier/package/agent 补到本文件
# 3. 人工填写所有 target_* 字段
# 4. python3 migrate_assets.py / migrate_runtime.py 正常出 SQL
# ============== 全局配置 ==============
# 迁移操作者(creator/updater/operator_id),通常是后台超级管理员账号 ID
# 上线前确认: SELECT id FROM tb_account WHERE login_account = 'admin' LIMIT 1;
migration_user_id: 0
# 本次迁移批次号。线上每次迁移必须使用独立批次,用于导入后收尾、验收和回滚定位。
migration_batch_no: "MIGRATION-QICHENG-YYYYMMDD"
# ============== 运营商映射 ==============
# scan_legacy 会按"奇成 tbl_card.category"分组写入,你只需填 target_*
carriers:
- legacy_category: 9
legacy_category_name: "中国联通"
target_carrier_id: null # 必填:新库 tb_carrier.id
target_carrier_type: null # 必填:CMCC / CUCC / CTCC / CBN
target_carrier_name: null # 必填:新库 carrier_name 快照
# ============== 套餐映射 ==============
# scan_legacy 会按"奇成 tbl_card_life.meal_id"分组写入
packages:
- legacy_meal_id: "D6554244711498752"
legacy_meal_name: "三网充电宝全国畅玩年卡套餐1000G/月12个月"
target_package_id: null # 必填:新库 tb_package.id
# ============== 套餐系列映射(可选) ==============
# 仅当你需要给迁移卡设置 tb_iot_card.series_id 时才填
series:
- legacy_series_id: "95A038B9D3014F9DA1539EC092D9DBAA"
legacy_series_name: "国内卡 无预存30天"
target_series_id: null # 可选:新库 tb_package_series.id,null=不写入
# ============== 代理-店铺映射 ==============
# scan_legacy 会按"奇成 tbl_card.agent_id"分组写入,你只需填 target_shop_code
# 留空(null)的代理:其卡进平台库存(除非 cards.csv 里显式指定 target_shop_code)
agents:
- legacy_agent_id: "D15EC779767B412A82B8448AC2324F04"
legacy_agent_name: "叶发伟"
target_shop_code: null # 新库 tb_shop.shop_code,null=不归任何店铺