Files
integral-shop/docs/com-sqszx202-data-imgration.md
2026-06-14 09:21:04 +08:00

81 lines
3.0 KiB
Markdown
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.
# 公司名称:宿迁盛泽鑫商贸
- host ip: 59.110.91.202
## mysql数据库配置信息
- datasource:
rds: rm-bp1a178eq62lxba9xbo.mysql.rds.aliyuncs.com
name: sqszx202
username: yangtangyoupin
password: 5Fn8eWrbYFtAhCZw
## 数据清理任务
- **用户数据范围**`wa_users.id` / `eb_user.uid` 保留名单:
`93164, 93133, 93132, 93113, 93216, 93230, 93238, 93258, 93277, 93283, 93284, 93291, 93293, 93308, 93299, 93290, 93280, 93279, 93255, 93252, 93251, 93250, 93249, 93248, 93223, 93221, 93111, 93099, 93263, 93265, 93272, 93270, 93269, 93268, 93267, 93266, 93276, 93278, 93286, 93296, 93309, 93281, 93275, 93271, 93139, 93264, 93247, 93218, 93217, 93194, 93142`
- 保留wa_users表中id在用户id数据范围的 ,删除其余用户数据
- 保留eb_user表中uid在用户id数据范围的 ,删除其余用户数据
- wa_order
清空wa_order表中数据
- wa_merchandise
保留数据库中“created_at >= 2026-06-12”并且seller_id或buyer_id在用户id数据范围的寄售商品删除其余数据
(当前库表字段为 `user_id` 表示卖家,实现时按 `user_id` 与日期条件过滤。)
- wa_selfbonus_log
只保留 `user_id` 在用户id数据范围内的记录删除其余数据
- wa_sharebonus_log
只保留 `user_id` 在用户id数据范围内的记录删除其余数据
- wa_coupon_log
只保留 `user_id` 在用户id数据范围内的记录删除其余数据
- wa_withdraw
清空wa_withdraw表中数据
- eb_store_order
清空eb_store_order表中数据
- eb_user_integral_record
只保留用户在名单内的记录;表字段为 `uid`(与 `wa_users.id` / `eb_user.uid` 对应),实现按 `uid` 过滤。
## 执行结果
- 已于 **2026-06-14** 按当前保留名单执行清理并 `COMMIT`
- 执行脚本:`docs/sql/run_com_sqszx202_cleanup.py`
- 执行前备份:`docs/sql/backups/sqszx202_cleanup_before_20260614_090658.sql.gz`(已通过 `gzip -t` 校验)
- `wa_merchandise` 从源 dump 解析结果dump 中共 3156 行,满足 `created_at >= 2026-06-12``user_id` 在名单内的保留商品为 54 行。
- 删除行数:
- `wa_order`3168
- `wa_withdraw`171
- `eb_store_order`348
- `wa_merchandise`3102
- `wa_selfbonus_log`2255
- `wa_sharebonus_log`2514
- `wa_coupon_log`208
- `eb_user_integral_record`2343
- `eb_user`79
- `wa_users`79
- 保留后行数:
- `wa_order`0
- `wa_withdraw`0
- `eb_store_order`0
- `wa_merchandise`54
- `wa_selfbonus_log`1644
- `wa_sharebonus_log`1791
- `wa_coupon_log`8
- `eb_user_integral_record`1993
- `eb_user`51
- `wa_users`51
- 复核:清理后再次 dry-run以上表剩余待删除行数均为 0。
## 相关文件
- 新公司初始会员信息: '/Users/mac/Works26/miao-july/宿迁盛泽鑫/盛泽鑫团队成员信息表.xlsx'
- 源数据dump文件 '/Users/mac/Works26/miao-july/宿迁盛泽鑫/anpengran-yangtangyoupin_2026-06-14_02-15-02_mysql_data.sql'