feat(server): legacy 码表 → codes 库新表的幂等回填(Go 双方言)(#codes-lib)

This commit is contained in:
wangjia
2026-07-10 14:13:21 +08:00
parent 7a4c9b97d0
commit 15f0d78a91
3 changed files with 328 additions and 0 deletions
+8
View File
@@ -17,6 +17,7 @@ import (
"log"
"os"
"github.com/wangjia/pangolin/server/internal/codes"
"github.com/wangjia/pangolin/server/internal/config"
"github.com/wangjia/pangolin/server/internal/store"
)
@@ -48,6 +49,13 @@ func main() {
if err := store.ApplyCodesLibMigrations(context.Background(), db, driver); err != nil {
log.Fatalf("migrate up (codes lib): %v", err)
}
n, err := codes.BackfillLegacy(context.Background(), db)
if err != nil {
log.Fatalf("migrate up (codes backfill): %v", err)
}
if n > 0 {
log.Printf("migrate: codes backfill — %d legacy codes migrated", n)
}
log.Println("migrate: up — done")
case "down":