connect, createschema, close
This commit is contained in:
34
cmd/migrate.go
Normal file
34
cmd/migrate.go
Normal file
@ -0,0 +1,34 @@
|
||||
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")
|
||||
}
|
@ -19,6 +19,8 @@ func init() {
|
||||
|
||||
// Here you will define your flags and configuration settings.
|
||||
|
||||
serveCmd.Flags().BoolVar(&configuration.Debug, "debug", false, "enable debug mode")
|
||||
|
||||
serveCmd.Flags().BoolVar(&configuration.RunHTTP, "http", true, "Run http server")
|
||||
serveCmd.Flags().BoolVar(&configuration.RunGRPC, "grpc", true, "Run grpc server")
|
||||
|
||||
|
Reference in New Issue
Block a user