diff --git a/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php b/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php index f74ed2663..729527067 100644 --- a/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php +++ b/lib/Doctrine/Migrations/Metadata/Storage/TableMetadataStorage.php @@ -198,7 +198,7 @@ private function isInitialized(): bool } if ($this->connection instanceof PrimaryReadReplicaConnection) { - $this->connection->connect('master'); + $this->connection->ensureConnectedToPrimary(); } return $this->schemaManager->tablesExist([$this->configuration->getTableName()]); diff --git a/tests/Doctrine/Migrations/Tests/Metadata/Storage/ExistingTableMetadataStorageTest.php b/tests/Doctrine/Migrations/Tests/Metadata/Storage/ExistingTableMetadataStorageTest.php index d6fe0c93e..442937cbb 100644 --- a/tests/Doctrine/Migrations/Tests/Metadata/Storage/ExistingTableMetadataStorageTest.php +++ b/tests/Doctrine/Migrations/Tests/Metadata/Storage/ExistingTableMetadataStorageTest.php @@ -83,8 +83,7 @@ public function testPrimaryReadReplicaConnectionGetsConnected(): void $connection = $this->createMock(PrimaryReadReplicaConnection::class); $connection ->expects(self::atLeastOnce()) - ->method('connect') - ->with('master'); + ->method('ensureConnectedToPrimary'); $connection ->expects(self::atLeastOnce())