35 lines
855 B
Go
35 lines
855 B
Go
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")
|
|
}
|