From b4769169361a63b1c531d47ead96223a45e9f5d9 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Wed, 19 Aug 2020 15:36:31 +0200 Subject: [PATCH] Restore initial admin password when running `photoprism reset` Signed-off-by: Michael Mayer --- internal/commands/reset.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/commands/reset.go b/internal/commands/reset.go index e3ff0b7e4..deb881d1e 100644 --- a/internal/commands/reset.go +++ b/internal/commands/reset.go @@ -51,9 +51,14 @@ func resetAction(ctx *cli.Context) error { log.Infoln("dropping existing tables") tables.Drop() - log.Infoln("creating new tables") - tables.Migrate() - tables.WaitForMigration() + + log.Infoln("restoring default schema") + entity.MigrateDb() + + if conf.AdminPassword() != "" { + log.Infoln("restoring initial admin password") + entity.Admin.InitPassword(conf.AdminPassword()) + } log.Infof("database reset completed in %s", time.Since(start))