feat(server): 迁移 000021 pay_purchases 台账 + subscriptions.source 扩 pay

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
wangjia
2026-07-10 20:46:13 +08:00
parent 3df5867c02
commit 85140edf1c
6 changed files with 84 additions and 2 deletions
@@ -104,6 +104,12 @@ func TestCodesLibMigrateRoundTrip(t *testing.T) {
// the reviewer's repro hit: the lib's `codes` table collides with the
// name 000020's down script renames legacy_codes back to.
m := newSQLiteStepper(t, db)
// 000021 (pay_purchases/source-enum) now sits on top of 000020 and is
// unrelated to this collision — step it back down first so we land
// exactly on the 000020 boundary the test targets.
if err := m.Steps(-1); err != nil {
t.Fatalf("step 000021 down: %v", err)
}
if err := m.Steps(-1); err != nil {
t.Fatalf("step 000020 down: %v (this is the reviewer-reported collision — "+
"000020 down must DROP the codes-lib tables before renaming legacy_* back)", err)
+3 -2
View File
@@ -29,8 +29,8 @@ func TestSQLiteMigrateUpDown(t *testing.T) {
if dirty {
t.Fatalf("schema dirty after MigrateUp")
}
if v != 20 {
t.Errorf("version = %d, want 20", v)
if v != 21 {
t.Errorf("version = %d, want 21", v)
}
// 2. Core tables exist.
@@ -39,6 +39,7 @@ func TestSQLiteMigrateUpDown(t *testing.T) {
"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",
"pay_purchases",
} {
var name string
err := db.QueryRow(