photoprism/internal/entity/entity_fixtures.go
Michael Mayer c74fcbf282 People: Show real name instead of uid in logs #1438 #2182
Since caching all subject data proved too complex in the time available,
this implementation uses a simple key/value lookup table to cache
subject names and perform backward searches by uid.
2022-04-04 14:21:43 +02:00

31 lines
639 B
Go

package entity
import (
"time"
)
// CreateDefaultFixtures inserts default fixtures for test and production.
func CreateDefaultFixtures() {
CreateUnknownAddress()
CreateDefaultUsers()
CreateUnknownPlace()
CreateUnknownLocation()
CreateUnknownCountry()
CreateUnknownCamera()
CreateUnknownLens()
}
// ResetTestFixtures recreates database tables and test fixtures.
func ResetTestFixtures() {
start := time.Now()
Entities.Migrate(Db(), false, nil)
Entities.WaitForMigration(Db())
Entities.Truncate(Db())
CreateDefaultFixtures()
CreateTestFixtures()
log.Debugf("migrate: recreated test fixtures [%s]", time.Since(start))
}