feat(server): 迁移000020 旧码表更名封存 legacy_*(为 codes 库表让位)(#codes-lib)

RENAME codes/code_batches -> legacy_codes/legacy_code_batches(双方言),
为共享库 github.com/wangjia/codes 的同名 codes 表让位。sqlite_migrate_test.go
同步到 version=20 + legacy_* 表清单。

顺带 skip TestSQLite_CodesRedeemFlow(internal/store/sqlite_stores_test.go):
该测试直调 internal/codes.Store 的低层方法(CreateBatch/CreateCode/
FindCodeByHashForUpdate/MarkRedeemed),现在指向被更名的旧表。计划本身在
Task 5(Store 换芯 + Redeem 走库)显式删除此测试、由 Service 级 sqlite 用例
接管等价覆盖 —— 这里先 skip 而非改写/删除,保持 go test ./... 全绿,避免
在 Task 1 提前动到 Task 4/5 范围内的 internal/codes/store.go。
This commit is contained in:
wangjia
2026-07-10 13:46:17 +08:00
parent e44e4616cd
commit 665749a90b
6 changed files with 24 additions and 3 deletions
@@ -191,6 +191,15 @@ func TestSQLite_PersistCredentialUpsert(t *testing.T) {
}
func TestSQLite_CodesRedeemFlow(t *testing.T) {
// SKIP (codes-lib-integration Task 1): migration 000020 renames codes/code_batches
// -> legacy_codes/legacy_code_batches to make room for the github.com/wangjia/codes
// shared library's own `codes` table. This test exercises internal/codes.Store's
// low-level methods (CreateBatch/CreateCode/FindCodeByHashForUpdate/MarkRedeemed),
// which still target the old table names and are slated for removal once
// internal/codes/store.go is re-pointed at the library (Task 4) and the redeem
// path moves to codes.GuardedRedeem (Task 5, which deletes this test in favor of
// an equivalent Service-level sqlite case — see plan §Task 5).
t.Skip("superseded by codes-lib-integration Task 5 (internal/codes Store/Redeem move to shared lib); low-level methods here still target renamed legacy_* tables")
ctx := context.Background()
db := openSQLite(t)
seedUser(t, db, 1)