mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Create metadata document from outside if duplicate on shared tables V1
This commit is contained in:
parent
5fcb990b1c
commit
d979c0c914
2 changed files with 16 additions and 2 deletions
|
|
@ -234,7 +234,21 @@ App::post('/v1/projects')
|
|||
|
||||
$attributes = \array_map(fn ($attribute) => new Document($attribute), $collection['attributes']);
|
||||
$indexes = \array_map(fn (array $index) => new Document($index), $collection['indexes']);
|
||||
$dbForProject->createCollection($key, $attributes, $indexes);
|
||||
|
||||
try {
|
||||
$dbForProject->createCollection($key, $attributes, $indexes);
|
||||
} catch (Duplicate) {
|
||||
if (!$globalCollections) {
|
||||
$dbForProject->createDocument(Database::METADATA, new Document([
|
||||
'$id' => ID::custom($key),
|
||||
'$permissions' => [Permission::create(Role::any())],
|
||||
'name' => $key,
|
||||
'attributes' => $attributes,
|
||||
'indexes' => $indexes,
|
||||
'documentSecurity' => true
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
2
composer.lock
generated
2
composer.lock
generated
|
|
@ -7038,5 +7038,5 @@
|
|||
"platform-overrides": {
|
||||
"php": "8.3"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue