accountserver/cmd/migrate.go

35 lines
855 B
Go
Raw Permalink Normal View History

2024-08-19 14:15:44 +02:00
package cmd
import (
"code.icod.de/auth/accountserver/service"
"github.com/spf13/cobra"
)
// migrateCmd represents the migrate command
var migrateCmd = &cobra.Command{
Use: "migrate",
Short: "Create Schema",
RunE: func(cmd *cobra.Command, args []string) error {
s := service.NewService()
s.Connect()
if e := s.CreateSchema(); e != nil {
return e
}
return s.Close()
},
}
func init() {
rootCmd.AddCommand(migrateCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// migrateCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// migrateCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}