Files
ai-agent/cmd/migration/main.go
T
mlogclub efe801b8bf Init
2026-04-09 10:01:23 +08:00

33 lines
659 B
Go

package main
import (
"log/slog"
"cs-agent/internal/bootstrap"
"cs-agent/internal/pkg/config"
"cs-agent/internal/pkg/logx"
)
func main() {
cfg, err := config.Load("config/config.yaml")
if err != nil {
slog.Error("load config failed", "error", err)
return
}
logx.Init(logx.Config{
Level: cfg.Logger.Level,
Format: cfg.Logger.Format,
AddSource: cfg.Logger.AddSource,
})
if _, err = bootstrap.InitDB(cfg.DB); err != nil {
slog.Error("init db failed", "error", err)
return
}
if err = bootstrap.InitMigrations(); err != nil {
slog.Error("run migrations failed", "error", err)
return
}
slog.Info("migrations completed")
}