github.com/paweljw/pop/v5@v5.4.6/soda/cmd/migrate_up.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/gobuffalo/pop/v5"
     5  	"github.com/spf13/cobra"
     6  )
     7  
     8  var migrationStepUp int
     9  
    10  var migrateUpCmd = &cobra.Command{
    11  	Use:   "up",
    12  	Short: "Apply one or more of the 'up' 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  		_, err = mig.UpTo(migrationStepUp)
    19  		return err
    20  	},
    21  }
    22  
    23  func init() {
    24  	migrateCmd.AddCommand(migrateUpCmd)
    25  	migrateUpCmd.Flags().IntVarP(&migrationStepUp, "step", "s", 0, "Number of migrations to apply. Use 0 to apply all pending.")
    26  }