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
+3 -3
View File
@@ -29,13 +29,13 @@ func TestSQLiteMigrateUpDown(t *testing.T) {
if dirty {
t.Fatalf("schema dirty after MigrateUp")
}
if v != 19 {
t.Errorf("version = %d, want 19", v)
if v != 20 {
t.Errorf("version = %d, want 20", v)
}
// 2. Core tables exist.
for _, tbl := range []string{
"users", "devices", "plans", "subscriptions", "code_batches", "codes",
"users", "devices", "plans", "subscriptions", "legacy_code_batches", "legacy_codes",
"usage_daily", "audit_log", "providers", "nodes", "node_events",
"directory_version", "provision_idempotency", "replacements", "admins",
"connect_credentials", "usage_device_daily", "sessions", "usage_hourly", "usage_device_hourly",