github.com/duskeagle/pop@v4.10.1-0.20190417200916-92f2b794aab5+incompatible/soda/cmd/migrate_down.go (about) 1 package cmd 2 3 import ( 4 "github.com/gobuffalo/pop" 5 "github.com/pkg/errors" 6 "github.com/spf13/cobra" 7 ) 8 9 var migrationStep int 10 11 var migrateDownCmd = &cobra.Command{ 12 Use: "down", 13 Short: "Apply one or more of the 'down' migrations.", 14 RunE: func(cmd *cobra.Command, args []string) error { 15 mig, err := pop.NewFileMigrator(migrationPath, getConn()) 16 if err != nil { 17 return errors.WithStack(err) 18 } 19 return mig.Down(migrationStep) 20 }, 21 } 22 23 func init() { 24 migrateCmd.AddCommand(migrateDownCmd) 25 migrateDownCmd.Flags().IntVarP(&migrationStep, "step", "s", 1, "Number of migration to down") 26 }