test: harden pocketbase dry run readiness

This commit is contained in:
Codex
2026-06-30 02:23:17 +08:00
parent 7eaf26fa40
commit 52cef9f13d
7 changed files with 223 additions and 15 deletions

View File

@@ -320,16 +320,18 @@ npm run pb:import:dry-run -- --json
dry-run 会检查导出目录、JSON 形态、核心集合缺失、重复/缺失旧 ID、敏感字段、旧 schema 关系断裂和未映射集合。存在 blocker 时命令返回非 0所有 blocker 处理完后,再执行 `npm run pb:import:json``npm run pb:import:validate`
默认 dry-run 使用 `development` profile正式迁移、预生产验收和 CI 应使用 `production` profile。生产 profile 会额外输出 `migrationReadiness`,检查用户、题目、科目、分类、订单、套餐、激活码、单词和知识手册等必需集合,以及用户手机号、题目归属、订单套餐、激活码、单词和手册归属等关键字段覆盖率。`--profile` 只接受 `development``production`,拼写错误会按 blocker 失败。
真实生产数据迁移不要只看命令是否能跑完,需要按迁移验收 runbook 执行 dry-run、正式导入演练、导入后校验、业务抽样、Taro 联调、冻结切换和回滚准备:
```text
docs/refactor/pocketbase-real-data-migration-runbook.md
```
正式切换前建议使用严格模式:
正式切换前建议使用 production 严格模式:
```bash
npm run pb:import:dry-run -- --json --fail-on-warnings
npm run pb:import:dry-run -- --profile=production --json --fail-on-warnings
```
导入后校验建议在预生产/生产切换前把 warning 也作为阻断: