github.com/wawandco/oxplugins@v0.7.11/tools/pop/migrate/down.go (about) 1 package migrate 2 3 import ( 4 "github.com/gobuffalo/pop/v5" 5 ) 6 7 // RunDown will run migrations on the current folder, it will look for the 8 // migrations folder and attempt to run the migrations using internal 9 // pop tooling 10 func (mu *Command) RunDown() error { 11 pop.SetLogger(mu.Log) 12 conn := pop.Connections[mu.connectionName] 13 if conn == nil { 14 return ErrCouldNotFindConnection 15 } 16 17 mig, err := pop.NewMigrationBox(mu.migrations, conn) 18 if err != nil { 19 return err 20 } 21 22 if mu.steps == 0 { 23 mu.steps = 1 24 } 25 26 return mig.Down(mu.steps) 27 }