编码期测试的 DB 时序从「DROP+CREATE 空库 → Flyway 从零重建 → seed」
改为「mysqldump 复制源库→一次性副本 → Flyway 只 apply 本轮新迁移 →
跑测试 → 绿后晋升新迁移到源库 → 无论红绿删副本」。
- 新模板 scripts/drop-test-db.mjs(删副本,硬拒删源库)、
scripts/promote-to-source.mjs(移植 flyway 历史行+重放迁移到源库;
跨 lane 串行由编排层 testGate 起栈互斥保证,文件锁兜底同树重跑)
- setup-test-db:DROP 空库 → 复制源库到副本;test.mjs:try/finally
删副本 + 绿后晋升 + 串行缺省显式导出副本名 <schema>__test
- 命名约定(5 脚本共享):COPY = env > marker > <source>__test,
每脚本 COPY===SOURCE 即拒绝;application*.yml 占位缺省改为副本名
- 新 lib/bootstrap-source-flyway.mjs:db-init 建源库+apply V1+写
checksum 与 Flyway 一致的历史行(Plan 期无 app 可起,手算 CRC32);
db-init B 段三步换一次 bootstrap 调用
- coding.mjs 各闸时序对齐;globalTeardown 只 kill 不删副本(teardown
删副本会让其后的 promote 查不到副本历史而静默跳过晋升);行为门/
seed 契约允许清单补 drop-test-db;前端 testGate 补收尾删副本
- 模板测试重写 + 新增 drop/promote/bootstrap 测试(133 全绿,全离线)
已知残留:bootstrap 手算 Flyway checksum 未真机验证(若不一致首次
起后端报 checksum mismatch,改 flywayChecksum 一处即可);演示种子
固定主键区间 1000–9999 与源库真实自增数据增长存在长期碰撞风险。