sync with feat-migration

This commit is contained in:
shimon 2024-10-21 18:57:11 +03:00
parent a41b767400
commit 3ff5472543

View file

@ -207,7 +207,6 @@ App::post('/v1/projects')
if (\in_array($dsn->getHost(), $sharedTables)) {
$dbForProject
->setSharedTables(true)
->setTenant($project->getInternalId())
->setTenant($globalCollections ? null : $project->getInternalId())
->setNamespace($dsn->getParam('namespace'));
} else {
@ -225,8 +224,6 @@ App::post('/v1/projects')
$create = false;
}
if ($create || !$globalCollections) {
$audit = new Audit($dbForProject);
$audit->setup();
@ -247,7 +244,16 @@ App::post('/v1/projects')
try {
$dbForProject->createCollection($key, $attributes, $indexes);
} catch (Duplicate) {
// Collection already exists
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
]));
}
}
}
}