feat(server): legacy 码表 → codes 库新表的幂等回填(Go 双方言)(#codes-lib)
This commit is contained in:
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user