mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
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.
This commit is contained in:
55
internal/entity/mysql8_test.go
Normal file
55
internal/entity/mysql8_test.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
func TestMySQL8(t *testing.T) {
|
||||
dbDsn := os.Getenv("PHOTOPRISM_TEST_DSN_MYSQL8")
|
||||
|
||||
if dbDsn == "" {
|
||||
t.Skip("skipping MySQL 8 test: PHOTOPRISM_TEST_DSN_MYSQL8 is not set")
|
||||
}
|
||||
|
||||
dbDriver := MySQL
|
||||
db, err := gorm.Open(dbDriver, dbDsn)
|
||||
|
||||
if err != nil || db == nil {
|
||||
for i := 1; i <= 5; i++ {
|
||||
db, err = gorm.Open(dbDriver, dbDsn)
|
||||
|
||||
if db != nil && err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
|
||||
if err != nil || db == nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
|
||||
db.LogMode(false)
|
||||
|
||||
DeprecatedTables.Drop(db)
|
||||
Entities.Drop(db)
|
||||
|
||||
// First migration.
|
||||
Entities.Migrate(db, false, nil)
|
||||
Entities.WaitForMigration(db)
|
||||
|
||||
// Second migration.
|
||||
Entities.Migrate(db, false, nil)
|
||||
Entities.WaitForMigration(db)
|
||||
|
||||
// Third migration with force flag.
|
||||
Entities.Migrate(db, true, []string{"20211121-094727"})
|
||||
Entities.WaitForMigration(db)
|
||||
}
|
||||
Reference in New Issue
Block a user