Init commit repo setup
This commit is contained in:
30
cmd/migrations/main.go
Normal file
30
cmd/migrations/main.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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.Fatal("cybertron migrations failed", zap.Error(err))
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
if err := command.Execute(); err != nil {
|
||||
log.Fatal("cybertron migrations command execution failed", zap.Error(err))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user