diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index 2efd5bd94..cbe171039 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -38,7 +38,7 @@ services: PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DSN: ".test.db" - PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" + # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # The initial admin password (min 4 characters) PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" diff --git a/docker-compose.mariadb.yml b/docker-compose.mariadb.yml index 974de485b..3969db39f 100644 --- a/docker-compose.mariadb.yml +++ b/docker-compose.mariadb.yml @@ -76,6 +76,21 @@ services: MYSQL_PASSWORD: photoprism MYSQL_DATABASE: photoprism + ## MySQL 8 Database Server + ## Docs: https://dev.mysql.com/doc/refman/8.0/en/ + mysql: + image: mysql:8 + command: mysqld --port=4001 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120 + expose: + - "4001" # Database port (internal) + volumes: + - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" + environment: + MYSQL_ROOT_PASSWORD: photoprism + MYSQL_USER: photoprism + MYSQL_PASSWORD: photoprism + MYSQL_DATABASE: photoprism + ## Join shared "photoprism-develop" network networks: default: diff --git a/docker-compose.yml b/docker-compose.yml index f54ce912a..c46e5b22b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,7 +73,7 @@ services: PHOTOPRISM_DATABASE_PASSWORD: "photoprism" PHOTOPRISM_TEST_DRIVER: "sqlite" PHOTOPRISM_TEST_DSN: ".test.db" - PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" + # PHOTOPRISM_TEST_DSN_MYSQL8: "root:photoprism@tcp(mysql:4001)/photoprism?charset=utf8mb4,utf8&collation=utf8mb4_unicode_ci&parseTime=true" PHOTOPRISM_ASSETS_PATH: "/go/src/github.com/photoprism/photoprism/assets" PHOTOPRISM_STORAGE_PATH: "/go/src/github.com/photoprism/photoprism/storage" PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/storage/originals" @@ -136,21 +136,6 @@ services: MYSQL_PASSWORD: photoprism MYSQL_DATABASE: photoprism - ## MySQL Database Server - ## Docs: https://dev.mysql.com/doc/refman/8.0/en/ - mysql: - image: mysql:8 - command: mysqld --port=4001 --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120 - expose: - - "4001" # Database port (internal) - volumes: - - "./scripts/sql/mariadb-init.sql:/docker-entrypoint-initdb.d/init.sql" - environment: - MYSQL_ROOT_PASSWORD: photoprism - MYSQL_USER: photoprism - MYSQL_PASSWORD: photoprism - MYSQL_DATABASE: photoprism - ## Keycloak OpenID Connect Provider ## Test User: user / photoprism ## Test Admin: admin / photoprism diff --git a/internal/entity/db_mysql8_test.go b/internal/entity/db_mysql8_test.go index 49a342316..14ab13a97 100644 --- a/internal/entity/db_mysql8_test.go +++ b/internal/entity/db_mysql8_test.go @@ -9,9 +9,13 @@ import ( ) func TestMySQL8(t *testing.T) { - dbDriver := MySQL 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 {