diff --git a/src/Database/Database.php b/src/Database/Database.php index ffb0ff4da..ac58d72f0 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1796,8 +1796,10 @@ public function createCollection(string $id, array $attributes = [], array $inde $this->adapter->createCollection($id, $attributes, $indexes); $createdPhysicalTable = true; } catch (DuplicateException $e) { - if ($this->adapter->getSharedTables() - && ($id === self::METADATA || $this->adapter->exists($this->adapter->getDatabase(), $id))) { + if ($id === self::METADATA + || ($this->adapter->getSharedTables() + && $this->adapter->exists($this->adapter->getDatabase(), $id))) { + // The metadata table must never be dropped during reconciliation. // In shared-tables mode the physical table is reused across // tenants. A DuplicateException simply means the table already // exists for another tenant — not an orphan.