github.com/duskeagle/pop@v4.10.1-0.20190417200916-92f2b794aab5+incompatible/soda/cmd/migrate_reset.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/gobuffalo/pop"
     5  	"github.com/markbates/oncer"
     6  	"github.com/pkg/errors"
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  // Deprecated: use resetCmd instead.
    11  var migrateResetCmd = &cobra.Command{
    12  	Use:   "reset",
    13  	Short: "The equivalent of running `migrate down` and then `migrate up`",
    14  	RunE: func(cmd *cobra.Command, args []string) error {
    15  		oncer.Deprecate(0, "command `migrate reset`", "Use command `reset` instead.")
    16  		mig, err := pop.NewFileMigrator(migrationPath, getConn())
    17  		if err != nil {
    18  			return errors.WithStack(err)
    19  		}
    20  		return mig.Reset()
    21  	},
    22  }
    23  
    24  func init() {
    25  	migrateCmd.AddCommand(migrateResetCmd)
    26  }