Migrations: Improve debug log messages

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-02-14 11:38:00 +01:00
parent 0c4aa86f85
commit d4cbb60b92

View file

@ -1,6 +1,7 @@
package migrate package migrate
import ( import (
"fmt"
"time" "time"
"github.com/photoprism/photoprism/pkg/list" "github.com/photoprism/photoprism/pkg/list"
@ -73,10 +74,10 @@ func (m *Migrations) Start(db *gorm.DB, opt Options) {
executed := Existing(db, opt.StageName()) executed := Existing(db, opt.StageName())
if prev := len(executed); prev == 0 { if prev := len(executed); prev == 0 {
log.Debugf("migrate: no previously executed migrations [%s]", opt.StageName()) log.Debugf("migrate: no previously executed %s stage migrations", opt.StageName())
} else { } else {
log.Debugf("migrate: executing %s migrations", opt.StageName()) stage := fmt.Sprintf("previously executed %s stage", opt.StageName())
log.Debugf("migrate: found %s", english.Plural(len(executed), "previous migration", "previous migrations")) log.Debugf("migrate: found %s", english.Plural(len(executed), stage+" migration", stage+" migrations"))
} }
for _, migration := range *m { for _, migration := range *m {