Accept Apper in writefreely.Migrate()

instead of *App
This commit is contained in:
Matt Baer 2019-07-03 14:39:05 -04:00
parent 3faa2def08
commit 79cf6ce0eb

10
app.go
View file

@ -564,12 +564,12 @@ func CreateSchema(apper Apper) error {
}
// Migrate runs all necessary database migrations.
func Migrate(app *App) error {
app.LoadConfig()
connectToDatabase(app)
defer shutdown(app)
func Migrate(apper Apper) error {
apper.LoadConfig()
connectToDatabase(apper.App())
defer shutdown(apper.App())
err := migrations.Migrate(migrations.NewDatastore(app.db.DB, app.db.driverName))
err := migrations.Migrate(migrations.NewDatastore(apper.App().db.DB, apper.App().db.driverName))
if err != nil {
return fmt.Errorf("migrate: %s", err)
}