-- ============================================================ -- 数据看板 V2 迁移脚本 -- 执行前请备份相关表 -- ============================================================ -- 1. 将历史福利流水的 flow_type 改为 7(新增福利专用类型) -- 原 flow_type: 1=充值, 2=提现, 3=划转转入, 4=划转转出, 5=买入, 6=卖出 -- 新增 flow_type: 7=福利发放 UPDATE account_flow SET flow_type = 7 WHERE remark LIKE '%新手奖励%' OR remark LIKE '%推广奖励%' OR remark LIKE '%间接推广%'; -- 2. 为 account_flow.flow_type 添加索引(加速看板福利汇总查询) ALTER TABLE account_flow ADD INDEX idx_flow_type (flow_type); -- 3. 为 order_fund 添加 type+status 复合索引(加速看板聚合查询) ALTER TABLE order_fund ADD INDEX idx_type_status (type, status);