diff --git a/src/Doctrine/SchemaConnection.php b/src/Doctrine/SchemaConnection.php index b19d14d..5943bf5 100644 --- a/src/Doctrine/SchemaConnection.php +++ b/src/Doctrine/SchemaConnection.php @@ -12,6 +12,7 @@ class SchemaConnection extends DBALConnection { private static ?BaggageSchemaResolver $schemaResolver = null; + private ?string $currentSchema = null; public static function setSchemaResolver(BaggageSchemaResolver $resolver): void { @@ -32,8 +33,13 @@ public function connect(): bool return $connection; } + if ($this->currentSchema === $schema) { + return $connection; + } + $this->ensurePostgreSql(); $this->applySearchPath($schema); + $this->currentSchema = $schema; return $connection; }