fix(db): isolate redemption migration from identity schema
This commit is contained in:
@@ -2458,3 +2458,19 @@
|
||||
- 相关记录:BUG-126、BUG-132
|
||||
- 复发自:BUG-126(模式:新增页面未同步能力审计精确路由集合)
|
||||
- 修复版本:待 follow-up commit / gate
|
||||
|
||||
## BUG-144 | db/migrations 副本依赖业务 schema 导致 identity-only fixture 迁移失败
|
||||
|
||||
- 状态:resolved(local candidate,远端 gate 待 follow-up 更新)
|
||||
- 首次发现:2026-08-07
|
||||
- 最近更新:2026-08-07
|
||||
- 影响面:`frontend/db/migrations/20260807020000_redeem_security.sql`(已删除)、`frontend/tests/redeem-orders-contract.test.ts`、`frontend/tests/database-redeem-security.test.ts`;staging quality gate run `1552` frontend 1054 passed / 2 failed,Python quick 291 passed / 1 skipped,publish / deploy 均未发生。
|
||||
- 用户现象:gate run `1552` 数据库真实失败,publish 被跳过,自动 deploy 未发生。
|
||||
- 触发条件:新增依赖业务 schema(`public.redemption_codes`、`public.credit_transactions`)的 redemption 安全迁移时,同时在 `frontend/db/migrations` 与 `frontend/supabase/migrations` 各放一份;`database-local-business` 聚合迁移(两目录全量)通过,而只应用 `frontend/db/migrations` 的 identity-only fixture 中业务 schema 尚不存在。
|
||||
- 根因:`database-self-hosted-identity` 与 `identity-auth-integration` 只应用 `frontend/db/migrations`(identity foundation),新的 db 副本假设 `public.redemption_codes` 已由 supabase compatibility 迁移创建;identity-only 序列因此 `migration failed`,与 BUG-127 同类(新增业务表必须精确选择迁移位置/全迁移),但不是 BUG-127 或 BUG-143 的复发,属本变更独立根因。
|
||||
- 修复:删除 `frontend/db/migrations/20260807020000_redeem_security.sql`,仅保留 `frontend/supabase/migrations/20260807030000_redeem_security.sql`;contract 测试只审该单一 migration,删除 byte-identical 双副本断言,并新增硬防线:断言 `frontend/db/migrations/20260807020000_redeem_security.sql` 不存在(`existsSync === false`);DB security 测试 aggregate runner 只期望 `applied 20260807030000_redeem_security.sql`,不再期待 070200,并断言 stdout 不含 `20260807020000_redeem_security`;SQL 内容未作任何变更。
|
||||
- 验证:本机无 Docker,无法执行 identity-only 与 aggregate DB 实测;运行 `npx tsx --test tests/redeem-orders-contract.test.ts`(7 passed,原 6 项 + 新增 existsSync 防复发守卫 1 项)、`tsc --noEmit`(clean)与 `git diff --check` 通过;目标 identity DB 实测(`database-self-hosted-identity`、`identity-auth-integration`)与 aggregate DB 测试(`database-local-business`、`database-redeem-security`)留待远端 gate 确认,本记录不提前声称远端收口。
|
||||
- 防复发:`frontend/db/migrations` 只放 identity foundation 独立可执行迁移;依赖业务 schema(`public.redemption_codes`、`payment_orders` 等)的迁移只进 `frontend/supabase/migrations`;任何新增/删除迁移必须在本变更中同时跑 identity-only 两测试(`database-self-hosted-identity`、`identity-auth-integration`)与 aggregate DB 测试(`database-local-business` 等)。
|
||||
- 相关记录:BUG-127、BUG-143
|
||||
- 复发自:无(独立根因,非 BUG-127 / BUG-143 复发)
|
||||
- 修复版本:待 follow-up commit / gate
|
||||
|
||||
Reference in New Issue
Block a user