Files
create-glstack/template/services/api/cmd/migrate.go
Gregor Lohaus 8254a28baa init
2026-04-08 04:29:35 +02:00

38 lines
915 B
Go

/*
Copyright © 2026 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"<@var(context.project.goprefix)>/<@var(context.project.name)>/db"
"github.com/spf13/cobra"
)
// migrateCmd represents the migrate command
var migrateCmd = &cobra.Command{
Use: "migrate",
Short: "run database migrations",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
err := db.RunDbMigrations()
if err != nil {
return err
}
return nil
},
}
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")
}