docs(A10 W1)+bootstrap: Flyway 执行规格 + ai-agent 单一真相注释
承接 afee2d5 去重:A10 design 补 §3.1 W1 Flyway ready-to-run 规格(迁移清单/baseline-on-migrate=0/跨模块 ai-agent/spring.sql.init 收敛/dev-PG 验证门);platform-ai bootstrap-ai-agent.sql 头注释标注为唯一 classpath 源(platform-app 经依赖传递消费)。纯文档/注释,全 reactor 已绿。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,29 @@ EIP4 当前只有 **dev 形态**(手工 `run-dev.sh` 起两个 fat jar + 前
|
||||
|
||||
**最小可交付(MVP 切片)**:W1+W2+W3+W4 = 「一条 `docker compose up` 起全栈、Flyway 自动建平台表、nginx 单源访问」。W5/W6 需准生产环境,独立排期。
|
||||
|
||||
## 3.1 W1 Flyway 详细执行规格(ready-to-run,2026-06-25 勘探后细化)
|
||||
|
||||
> **状态**:未实现(需 PG 验 migrate 才能安全落地)。但已做前置去重 + 钉死精确步骤,接 PG 即可执行。
|
||||
> **已做前置(2026-06-25)**:`bootstrap-ai-agent.sql` 两份去重——删 platform-app 副本,单一真相归 `platform-ai/src/main/resources/bootstrap/bootstrap-ai-agent.sql`(platform-app 经依赖传递消费;原同 classpath 路径双副本=解析歧义,已消除)。
|
||||
|
||||
**为何需 PG 才能安全做**:迁移 SQL 是 PG 专有(`::jsonb`/`::xml`/`ON CONFLICT`),H2 跑不了;本机 Docker daemon 未起→testcontainers 也用不了。盲发自动 migrate 进客户库启动路径=高爆炸半径,必须先在 dev PG 验过 `flyway migrate` + 回退。
|
||||
|
||||
**迁移清单(EIP4 新增平台表,从既有【幂等】bootstrap 原样迁入)**
|
||||
| 迁移 | 源(现状) | 表 |
|
||||
|---|---|---|
|
||||
| `V1__sys_page_schema.sql` | `platform-metadata/.../bootstrap/bootstrap-page-schema.sql` | sys_page_schema |
|
||||
| `V2__sys_datastatus.sql` | `platform-flow-gateway/.../bootstrap/bootstrap-datastatus.sql` | sys_datastatus(+种子) |
|
||||
| `V3__sys_ai_agent.sql` | `platform-ai/.../bootstrap/bootstrap-ai-agent.sql` | sys_ai_task/draft/change_set/run/feature_package/revision/audit_log |
|
||||
| (排除) | `platform-parity/.../bootstrap/*`(对拍测试种子) / `docs/sql/*`(admin 页数据 upsert,评估后单列) / 客户 eip3 schema | — |
|
||||
|
||||
**配置(baseline 策略)**:`flyway-core` 加 platform-app;`spring.flyway`:`baseline-on-migrate=true`、`baseline-version=0`(客户库非空→baseline 于 V0=不动既有,再跑 V1+;迁移幂等→既有平台表也安全)、`locations=classpath:db/migration`。**先 gated**:`enabled: ${EIP4_FLYWAY_ENABLED:false}`,dev 验过再开,prod 经 env 显式启用。
|
||||
|
||||
**跨模块处理(ai-agent)**:sys_ai_* DDL 由 platform-ai 拥有并被 `AiAgentDdlTest` 测试。`V3` 迁移在 platform-app/db/migration,内容与 platform-ai 副本须一致——A10 W1 落地时二选一:① V3 引用/复制 platform-ai 副本并加防漂移测试;② 用 Flyway `locations` 叠加 `classpath:bootstrap`(但 bootstrap 非 V__ 命名,需重命名)。建议①。
|
||||
|
||||
**收敛 spring.sql.init**:W1 验过后,dev/local 的 `spring.sql.init.schema-locations` 改指 `classpath:db/migration/*.sql`(与 Flyway 同源),并删散落 bootstrap → 真单一真相。**收敛前 dev 行为不变**(spring.sql.init 仍跑现有 bootstrap,Flyway gated off,零回归)。
|
||||
|
||||
**验证门(接 PG 后)**:dev PG 跑 `flyway migrate`→`info`/`validate` 全绿 → 既有库 baseline 不破坏既有数据 → 回退演练 → 再 prod 开 `EIP4_FLYWAY_ENABLED=true`(W5 准生产)。
|
||||
|
||||
## 4. 待拍板决策点
|
||||
|
||||
| # | 决策 | 选项 | 建议 |
|
||||
|
||||
Reference in New Issue
Block a user