Compare commits

..

2 Commits

Author SHA1 Message Date
Steve Boyd
35f4268383
Merge 402a9f931e into 3eb61e353f 2024-10-03 04:12:41 +00:00
Steve Boyd
402a9f931e FIX Ensure primary connection is updated with temporary database 2024-10-03 17:12:35 +13:00

View File

@ -625,14 +625,9 @@ class TestSessionEnvironment
private function connectToDB(array $databaseConfig): void
{
if (method_exists(DB::class, 'hasConfig')) {
// CMS 5.4+ - ensure we connect the primary connection and not a replica
// which can happen if we use the default value of DB::CONN_DYNAMIC
// and there is a replica database configured
DB::connect($databaseConfig, DB::CONN_PRIMARY);
} else {
// CMS 5.3 and below do not support replica connections, use 'default' connection
DB::connect($databaseConfig);
}
// Ensure we connect the primary connection and not a replica
// which can happen if we use the default value of DB::CONN_DYNAMIC
// and there is a replica database configured
DB::connect($databaseConfig, DB::CONN_PRIMARY);
}
}