photoprism/internal/commands/migrate.go

29 lines
536 B
Go
Raw Normal View History

package commands
import (
"github.com/photoprism/photoprism/internal/config"
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 {
conf := config.NewConfig(ctx)
2019-05-02 14:10:05 +02:00
log.Infoln("migrating database")
conf.MigrateDb()
2019-05-02 14:10:05 +02:00
log.Infoln("database migration complete")
conf.Shutdown()
return nil
}