photoprism/internal/commands/migrate.go
Michael Mayer 9872cfaa50 Add ConfigCommand test #58
- Includes refactoring of existing packages to enable testing of commands
2018-11-17 13:57:19 +01:00

27 lines
477 B
Go

package commands
import (
"fmt"
"github.com/photoprism/photoprism/internal/context"
"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 := context.NewConfig(ctx)
fmt.Println("Migrating database...")
conf.MigrateDb()
fmt.Println("Done.")
return nil
}