7a4c9b97d0
Reviewer 复现:cmd/migrate up 接线 ApplyCodesLibMigrations 后,codes 库自建的 codes/codes_batches/codes_audit_log/codes_schema_migrations 四张表不受 golang-migrate 追踪;000020 的 down 脚本做 legacy_codes -> codes 改名回时, 撞上库自建的同名 codes 表,报 "table already exists" 硬失败。 000020 的 sqlite/mysql down 脚本改名前先 DROP TABLE IF EXISTS 掉库自建四张表, 并注明:down = 完整回滚「rename + 库建表」组合,库表数据随 down 销毁属预期 (权威数据仍在 legacy_* 表,回填是后续任务,回填落地后 down 语义需重新审视)。 新增 TestCodesLibMigrateRoundTrip 走真实接线路径(MigrateUp -> ApplyCodesLibMigrations -> 单步撤销 000020 断言 legacy 复原/库表清空 -> 撤销回去 -> 再跑 ApplyCodesLibMigrations 验幂等 -> 全量 store.MigrateDown 即 cmd/migrate down 的真实调用路径,确认不再硬失败)。先用 git stash 掉修复验证 测试能精确复现 reviewer 报的 "table already exists" 报错(RED),再恢复修复 转绿(GREEN)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u