chore(A10 W1): 收敛重复 bootstrap,db/migration 成平台表 DDL 单一真相

W1 引入 db/migration/V1-V3 后,平台表 DDL 在迁移与各模块 bootstrap-*.sql 重复
(评审揪出的"易漂移")。本次收敛,db/migration 成唯一真相:

- 删 3 份重复 bootstrap:bootstrap-page-schema(=V1)/bootstrap-datastatus(=V2)/
  bootstrap-ai-agent(=V3)。三者无运行态 classpath 消费者(已全仓核实)。
- AiAgentDdlTest(platform-ai,原读 bootstrap-ai-agent.sql)删除,等价覆盖迁入
  platform-app 新增 PlatformMigrationDdlGuardTest:① 守 V3 声明全部 AI 平台表/索引;
  ② 守 SchemaImportCli.CREATE_DDL ≡ V1(独立 CLI 兜底 DDL 防漂移)。
- SchemaImportCli.CREATE_DDL 由包私有改 public 供上述 guard 比对;两处过时注释改指 V1。
- ci.sh 平台表预灌改指 db/migration/V1(注:app 启动 Flyway 已幂等建表,此预灌仅冗余兜底)。
- docs 对齐:AI_AGENT_AUTO_DEVELOPMENT(spring.sql.init→Flyway)、docs/sql/SYS_PAGE_SCHEMA
  /SYS_AI_AGENT 头注释(待办→已落地)、A10 design 残留收敛标完成、deploy/README 残留项标完成。

边界:platform-parity 的 bootstrap-{sys,privilege,auth,xservice,multidim,flow}.sql 是
eip3 schema 对拍测试 fixture,非平台表副本,原样保留。

验证:全 reactor mvn clean install 绿;PlatformMigrationDdlGuardTest 2/2;独立 code-reviewer
评审 GO(零 CRITICAL/HIGH/MEDIUM,含 guard substring 逻辑对真实 V1 仿真核实)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-25 15:16:35 +08:00
parent b7fbae4cae
commit fa3c92b698
12 changed files with 94 additions and 228 deletions

View File

@@ -26,9 +26,10 @@ psql -h "$CI_PG_HOST" -p "$CI_PG_PORT" -U "$CI_PG_USER" -d "$CI_DB" -q \
-f platform-parity/src/main/resources/bootstrap/bootstrap-sys.sql
psql -h "$CI_PG_HOST" -p "$CI_PG_PORT" -U "$CI_PG_USER" -d "$CI_DB" -q \
-f platform-parity/src/main/resources/bootstrap/bootstrap-privilege.sql
# P4-4 平台表 SYS_PAGE_SCHEMA(页面 schema 服务化);幂等建表,数据由 SchemaImportCli 按需导入
# 平台表 SYS_PAGE_SCHEMA:单一真相 db/migration/V1(A10 W1 收敛,散落 bootstrap 已删)。
# 注:app 启动时 Flyway 已会幂等建全部平台表(V1-V3);此处预灌仅保证起服务前表已在(幂等无害)。
psql -h "$CI_PG_HOST" -p "$CI_PG_PORT" -U "$CI_PG_USER" -d "$CI_DB" -q \
-f platform-metadata/src/main/resources/bootstrap/bootstrap-page-schema.sql
-f platform-app/src/main/resources/db/migration/V1__sys_page_schema.sql
JDBC="jdbc:postgresql://${CI_PG_HOST}:${CI_PG_PORT}/${CI_DB}"
echo "==[3/4] 起服务(:${CI_PORT} → ${JDBC})=="