photoprism/internal/commands/migrate.go

27 lines
520 B
Go
Raw Normal View History

package commands
import (
"github.com/photoprism/photoprism/internal/context"
2019-05-02 14:10:05 +02:00
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
// Automatically migrates / initializes database
var MigrateCommand = cli.Command{
Name: "migrate",
Usage: "Automatically migrates / initializes database",
Action: migrateAction,
}
func migrateAction(ctx *cli.Context) error {
app := context.NewContext( ctx)
2019-05-02 14:10:05 +02:00
log.Infoln("migrating database")
app.MigrateDb()
2019-05-02 14:10:05 +02:00
log.Infoln("database migration complete")
return nil
}