feat: add pocketbase dry-run report

This commit is contained in:
Codex
2026-06-29 11:06:31 +08:00
parent e587a0c955
commit f74db433cc
14 changed files with 811 additions and 13 deletions

View File

@@ -157,8 +157,10 @@ npm run check:refactor
npm run check:api
npm run check:worker
npm run check:importer
npm run pb:import:dry-run
npm run pb:import:validate
npm run test:readiness
npm run test:pb:dry-run
npm run test:api
npm run test:worker:crm
npm run test:worker:commerce
@@ -183,6 +185,22 @@ npm run readiness:production:db
这个检查会阻断默认弱密钥、`CORS=*`、mock 短信、legacy 身份头、local_dev 存储、对象存储未配置、CRM insecure localhost 等生产风险;带 `:db` 的版本还会检查租户 provider 公开配置是否混入密钥、活跃短信/OAuth/支付 provider 是否缺少 `app_private.tenant_secrets`、域名是否未验证。
## PocketBase 迁移 Dry-Run
把旧 PocketBase 导出的集合 JSON 放到仓库根目录 `pb_export/` 后,先执行不写数据库的静态 dry-run
```bash
npm run pb:import:dry-run
```
需要给 CI 或脚本读取时:
```bash
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`
## API 模块
当前 API 目录: