refactor(migrator): use goose SQL only and auto-import zones on upgrade

移除 Go goose 迁移(bridge/legacy data/zone import),改为 goose SQL 占位
与结构迁移脚本;启动时 Migrate 在删旧列前自动导入历史域名,去掉
migrate-zones 手动命令及文档中的人工导入步骤。
This commit is contained in:
ryan
2026-07-12 15:36:00 +08:00
parent 5b52acdd6c
commit 03b81e5f74
19 changed files with 571 additions and 1252 deletions
-21
View File
@@ -1,21 +0,0 @@
// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
package cmd
import (
"context"
"github.com/Rain-kl/Wavelet/internal/apps/openflare/zone"
"github.com/Rain-kl/Wavelet/internal/db/migrator"
"github.com/spf13/cobra"
)
var migrateZonesCmd = &cobra.Command{
Use: "migrate-zones", Short: "导入旧域名数据到 Zone",
PreRun: func(_ *cobra.Command, _ []string) { migrator.Migrate() },
RunE: func(_ *cobra.Command, _ []string) error {
report, err := zone.ImportLegacy(context.Background())
return report.LogAndReturn(err)
},
}
+1 -1
View File
@@ -72,7 +72,7 @@ func init() {
schedulerCmd.PreRun = migratePreRun
// 2. 集中将这些命令注册为真正的子命令,以解决 Cobra 的 unknown command 校验限制
rootCmd.AddCommand(allCmd, apiCmd, workerCmd, schedulerCmd, migrateZonesCmd)
rootCmd.AddCommand(allCmd, apiCmd, workerCmd, schedulerCmd)
}
// Execute 执行根命令