diff --git a/src/Database/Database.php b/src/Database/Database.php index 0954625cc..9480ceb5e 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -1288,7 +1288,14 @@ public function createCollection(string $id, array $attributes = [], array $inde } } - $this->adapter->createCollection($id, $attributes, $indexes); + try { + $this->adapter->createCollection($id, $attributes, $indexes); + } catch (DuplicateException $e) { + // HACK: Metadata should still be updated, can be removed when null tenant collections are supported. + if (!$this->adapter->getSharedTables() || !$this->isMigrating()) { + throw $e; + } + } if ($id === self::METADATA) { return new Document(self::COLLECTION);