Files
eip4-platform/docs/sql/SYS_PAGE_SCHEMA.sql
zhengwr fa3c92b698 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>
2026-06-25 15:16:35 +08:00

35 lines
2.2 KiB
SQL
Raw Permalink 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.
-- ============================================================================
-- 生产建表脚本:SYS_PAGE_SCHEMA(平台表)
-- ----------------------------------------------------------------------------
-- 归属:platform-metadata(页面 schema 服务化,P4-4)。
-- 契约:GET /api/page/schema/{templateId} 的下发数据源。
--
-- 【Flyway 已落地(A10 W1,2026-06-25)】
-- 架构条款(docs/架构设计.md §「平台表管理」):SYS_* 平台表由 Flyway 管理。
-- ✅ 已引入 Flyway。本表【单一真相】= platform-app/src/main/resources/db/migration/V1__sys_page_schema.sql
-- (运行态由 Flyway 启动时幂等 migrate;内容与本脚本一致)。本文件保留为人读的生产建表参考。
-- 原 bootstrap-page-schema.sql 自举副本已删除(收敛入 V1)。
--
-- 初始数据导入(1489 个转换产物)由 SchemaImportCli 批量入库,不在本 DDL 内。
-- ============================================================================
CREATE TABLE IF NOT EXISTS sys_page_schema (
template_id character varying(64) NOT NULL,
name character varying(255),
schema_json jsonb NOT NULL,
schema_etag character varying(64) NOT NULL,
version integer NOT NULL DEFAULT 1,
update_time bigint NOT NULL,
CONSTRAINT pk_sys_page_schema PRIMARY KEY (template_id)
);
CREATE INDEX IF NOT EXISTS idx_sys_page_schema_name ON sys_page_schema (name);
COMMENT ON TABLE sys_page_schema IS '页面 amis schema 服务化存储(platform-converter 转换产物入库)';
COMMENT ON COLUMN sys_page_schema.template_id IS 'view_template_id(转换产物文件名去 .json)';
COMMENT ON COLUMN sys_page_schema.name IS '模板名称(取自分级清单.csv)';
COMMENT ON COLUMN sys_page_schema.schema_json IS 'amis 页面 schema(顶层 type:page),已过官方 schema.json 校验闸';
COMMENT ON COLUMN sys_page_schema.schema_etag IS 'schema_json 内容指纹(sha-256 hex),HTTP ETag/304 用';
COMMENT ON COLUMN sys_page_schema.version IS '单调递增版本(同模板重导入 +1)';
COMMENT ON COLUMN sys_page_schema.update_time IS 'epoch 毫秒';