From 2d841648bb03afa2741b831413e4fd687090081c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 9 May 2025 08:37:51 +0000 Subject: [PATCH] fix-db16-collection-creation --- src/Database/Database.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);