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