diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 9fad64a138..062756bb21 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -203,11 +203,12 @@ App::post('/v1/projects') $sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', '')); $sharedTablesV1 = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES_V1', '')); $globalCollections = !\in_array($dsn->getHost(), $sharedTablesV1); + if (\in_array($dsn->getHost(), $sharedTables)) { $dbForProject ->setSharedTables(true) ->setTenant($project->getInternalId()) - //->setTenant($globalCollections ? null : $project->getInternalId()) + ->setTenant($globalCollections ? null : $project->getInternalId()) ->setNamespace($dsn->getParam('namespace')); } else { $dbForProject @@ -218,14 +219,13 @@ App::post('/v1/projects') $create = true; - //try { - $dbForProject->create(); - //} catch (Duplicate) { - // $create = false; - //} + try { + $dbForProject->create(); + } catch (Duplicate) { + $create = false; + } - - //if ($create || !$globalCollections) { + if ($create || !$globalCollections) { $audit = new Audit($dbForProject); $audit->setup(); @@ -244,7 +244,7 @@ App::post('/v1/projects') $indexes = \array_map(fn (array $index) => new Document($index), $collection['indexes']); $dbForProject->createCollection($key, $attributes, $indexes); } - //} + } // Hook allowing instant project mirroring during migration // Outside of migration, hook is not registered and has no effect diff --git a/composer.json b/composer.json index 50881bec87..10f2a12492 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/cache": "0.10.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.53.6", + "utopia-php/database": "dev-feat-migrations as 0.53.6", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", "utopia-php/framework": "0.33.*",