Skip to content

Commit 72b2e2c

Browse files
authored
Merge pull request #580 from utopia-php/fix-db16-collection-creation
Fix: Collection creating on shared tables V1
2 parents 0859d86 + 2d84164 commit 72b2e2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Database/Database.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,14 @@ public function createCollection(string $id, array $attributes = [], array $inde
12881288
}
12891289
}
12901290

1291-
$this->adapter->createCollection($id, $attributes, $indexes);
1291+
try {
1292+
$this->adapter->createCollection($id, $attributes, $indexes);
1293+
} catch (DuplicateException $e) {
1294+
// HACK: Metadata should still be updated, can be removed when null tenant collections are supported.
1295+
if (!$this->adapter->getSharedTables() || !$this->isMigrating()) {
1296+
throw $e;
1297+
}
1298+
}
12921299

12931300
if ($id === self::METADATA) {
12941301
return new Document(self::COLLECTION);

0 commit comments

Comments
 (0)