diff --git a/backend/server/docker-compose.yml b/backend/server/docker-compose.yml index 12b4462..4a9733a 100644 --- a/backend/server/docker-compose.yml +++ b/backend/server/docker-compose.yml @@ -19,7 +19,6 @@ services: POSTGRES_PASSWORD: TODO_YOUR_POSTGRES_PASSWORD_HERE POSTGRES_DB: hishtory PGDATA: /var/lib/postgresql/data/pgdata - HISHTORY_COMPOSE_TEST: $HISHTORY_COMPOSE_TEST volumes: - postgres-data:/var/lib/postgresql/data healthcheck: @@ -42,6 +41,7 @@ services: delay: 3s environment: HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable + HISHTORY_COMPOSE_TEST: $HISHTORY_COMPOSE_TEST ports: - 80:8080 volumes: diff --git a/backend/server/server.go b/backend/server/server.go index 2c67c12..39d28b6 100644 --- a/backend/server/server.go +++ b/backend/server/server.go @@ -102,6 +102,7 @@ func OpenDB() (*database.DB, error) { } if os.Getenv("HISHTORY_COMPOSE_TEST") != "" { // Run an extra round of migrations to test the migration code path to prevent issues like #241 + fmt.Println("AutoMigrating DB tables a second time for test coverage") err := db.AddDatabaseTables() if err != nil { return nil, fmt.Errorf("failed to create underlying DB tables: %w", err)