github.com/kubeshop/testkube@v1.17.23/cmd/kubectl-testkube/commands/migrate.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common"
     7  	"github.com/kubeshop/testkube/pkg/ui"
     8  )
     9  
    10  func NewMigrateCmd() *cobra.Command {
    11  	cmd := &cobra.Command{
    12  		Use:   "migrate",
    13  		Short: "manual migrate command",
    14  		Long:  `migrate command will run migrations greater or equals current version`,
    15  		Run: func(cmd *cobra.Command, args []string) {
    16  			hasMigrations, err := common.RunMigrations(cmd)
    17  			ui.ExitOnError("Running migrations", err)
    18  			if hasMigrations {
    19  				ui.Success("All migrations executed successfully")
    20  			}
    21  		},
    22  	}
    23  
    24  	return cmd
    25  }