31 lines
616 B
Go
31 lines
616 B
Go
package main
|
|
|
|
import (
|
|
"cybertron/configs"
|
|
mig "cybertron/db"
|
|
"cybertron/pkg/log"
|
|
"github.com/spf13/cobra"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func main() {
|
|
configs.LoadMigConfig()
|
|
|
|
command := &cobra.Command{
|
|
Use: "migrations",
|
|
Short: "migrations",
|
|
Long: "running DB migrations",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
err := mig.RunDatabaseMigrations()
|
|
if err != nil {
|
|
log.Log.Fatal("cybertron migrations failed", zap.Error(err))
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
if err := command.Execute(); err != nil {
|
|
log.Log.Fatal("cybertron migrations command execution failed", zap.Error(err))
|
|
}
|
|
}
|