2018-09-24 09:53:16 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/photoprism/photoprism/internal/photoprism"
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
var MigrateCommand = cli.Command{
|
2018-09-27 08:59:53 +02:00
|
|
|
Name: "migrate",
|
|
|
|
Usage: "Automatically migrates / initializes database",
|
2018-09-24 09:53:16 +02:00
|
|
|
Action: migrateAction,
|
|
|
|
}
|
|
|
|
|
2018-10-31 02:42:54 +01:00
|
|
|
// Automatically migrates / initializes database; called by MigrateCommand
|
2018-09-27 08:59:53 +02:00
|
|
|
func migrateAction(context *cli.Context) error {
|
2018-09-24 09:53:16 +02:00
|
|
|
conf := photoprism.NewConfig(context)
|
|
|
|
|
|
|
|
fmt.Println("Migrating database...")
|
|
|
|
|
|
|
|
conf.MigrateDb()
|
|
|
|
|
|
|
|
fmt.Println("Done.")
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|