2026-07-26 18:24:13 +08:00
|
|
|
// 平台 API 的数据库迁移与版本命令行工具。
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
|
|
|
|
|
"git.apinb.com/heqiapp/platforms/backend/api/internal/config"
|
|
|
|
|
"git.apinb.com/heqiapp/platforms/backend/api/internal/impl"
|
|
|
|
|
_ "git.apinb.com/heqiapp/platforms/backend/api/internal/models"
|
|
|
|
|
)
|
|
|
|
|
|
2026-07-26 18:30:27 +08:00
|
|
|
const serviceKey = "heqi"
|
2026-07-26 18:24:13 +08:00
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
if len(os.Args) < 2 {
|
|
|
|
|
fmt.Println("usage: platform-cli <version|migrate>")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
switch os.Args[1] {
|
|
|
|
|
case "version":
|
|
|
|
|
fmt.Println("platform-cli 0.1.0")
|
|
|
|
|
case "migrate":
|
|
|
|
|
config.New(serviceKey)
|
|
|
|
|
impl.NewImpl()
|
|
|
|
|
fmt.Println("platform database auto migrate completed")
|
|
|
|
|
default:
|
|
|
|
|
fmt.Fprintf(os.Stderr, "unknown command: %s\n", os.Args[1])
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
}
|