diff --git a/composer.lock b/composer.lock index 51be2a1ae1..e0e9b7014d 100644 --- a/composer.lock +++ b/composer.lock @@ -1236,16 +1236,16 @@ }, { "name": "open-telemetry/api", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "ee17d937652eca06c2341b6fadc0f74c1c1a5af2" + "reference": "610b79ad9d6d97e8368bcb6c4d42394fbb87b522" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/ee17d937652eca06c2341b6fadc0f74c1c1a5af2", - "reference": "ee17d937652eca06c2341b6fadc0f74c1c1a5af2", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/610b79ad9d6d97e8368bcb6c4d42394fbb87b522", + "reference": "610b79ad9d6d97e8368bcb6c4d42394fbb87b522", "shasum": "" }, "require": { @@ -1265,7 +1265,7 @@ ] }, "branch-alias": { - "dev-main": "1.4.x-dev" + "dev-main": "1.7.x-dev" } }, "autoload": { @@ -1302,7 +1302,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-09-19T00:05:49+00:00" + "time": "2025-10-02T23:44:28+00:00" }, { "name": "open-telemetry/context", @@ -1492,22 +1492,22 @@ }, { "name": "open-telemetry/sdk", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "105c6e81e3d86150bd5704b00c7e4e165e957b89" + "reference": "8986bcbcbea79cb1ba9e91c1d621541ad63d6b3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/105c6e81e3d86150bd5704b00c7e4e165e957b89", - "reference": "105c6e81e3d86150bd5704b00c7e4e165e957b89", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/8986bcbcbea79cb1ba9e91c1d621541ad63d6b3e", + "reference": "8986bcbcbea79cb1ba9e91c1d621541ad63d6b3e", "shasum": "" }, "require": { "ext-json": "*", "nyholm/psr7-server": "^1.1", - "open-telemetry/api": "^1.6", + "open-telemetry/api": "^1.7", "open-telemetry/context": "^1.4", "open-telemetry/sem-conv": "^1.0", "php": "^8.1", @@ -1542,7 +1542,7 @@ ] }, "branch-alias": { - "dev-main": "1.0.x-dev" + "dev-main": "1.9.x-dev" } }, "autoload": { @@ -1585,7 +1585,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-09-19T00:05:49+00:00" + "time": "2025-10-02T23:44:28+00:00" }, { "name": "open-telemetry/sem-conv", @@ -5224,16 +5224,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "07a7d6276bd684b49469ad7b9e8c3c962121c6fd" + "reference": "e1ca749398189f36ec6d6afb8e9f64e9cb37e0a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/07a7d6276bd684b49469ad7b9e8c3c962121c6fd", - "reference": "07a7d6276bd684b49469ad7b9e8c3c962121c6fd", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/e1ca749398189f36ec6d6afb8e9f64e9cb37e0a3", + "reference": "e1ca749398189f36ec6d6afb8e9f64e9cb37e0a3", "shasum": "" }, "require": { @@ -5269,9 +5269,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.4.2" + "source": "https://github.com/appwrite/sdk-generator/tree/1.4.3" }, - "time": "2025-10-01T03:23:04+00:00" + "time": "2025-10-01T06:25:19+00:00" }, { "name": "doctrine/annotations", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php index 7fa64fca87..5270bc8229 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Action.php @@ -3,7 +3,6 @@ namespace Appwrite\Platform\Modules\Databases\Http\Databases; use Utopia\Platform\Action as UtopiaAction; -use Utopia\System\System; class Action extends UtopiaAction { @@ -14,26 +13,6 @@ class Action extends UtopiaAction return $this->context; } - public function getDatabaseDSN(): string - { - $database = System::getEnv('_APP_DATABASE_NAME', 'appwrite'); - $namespace = System::getEnv('_APP_DATABASE_SHARED_NAMESPACE', ''); - - $schema = match ($this->context) { - 'documentsdb' => 'mongodb', - 'tablesdb' => 'mysql', - default => 'mysql', - }; - - $dsn = $schema . '://' . $database; - - if (!empty($namespace)) { - $dsn .= '?namespace=' . $namespace; - } - - return $dsn; - } - public function setHttpPath(string $path): UtopiaAction { if (\str_contains($path, '/tablesdb')) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 320adccd6f..cd60c515e1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -76,12 +76,12 @@ class Create extends Action ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents): void + public function action(string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); @@ -109,12 +109,14 @@ class Create extends Action throw new Exception($this->getDuplicateException()); } catch (LimitException) { throw new Exception($this->getLimitException()); - } catch (NotFoundException $e) { + } catch (NotFoundException) { throw new Exception(Exception::DATABASE_NOT_FOUND); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + try { - $dbForDatabaseRecords->createCollection( + $dbForDatabase->createCollection( id: 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), permissions: $permissions, documentSecurity: $documentSecurity diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php index 8a3d732b6d..ba3ebf824e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Delete.php @@ -62,13 +62,13 @@ class Delete extends Action ->param('collectionId', '', new UID(), 'Collection ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, EventDatabase $queueForDatabase, Event $queueForEvents): void + public function action(string $databaseId, string $collectionId, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, EventDatabase $queueForDatabase, Event $queueForEvents): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -85,7 +85,8 @@ class Delete extends Action throw new Exception(Exception::GENERAL_SERVER_ERROR, "Failed to remove $type from DB"); } - $dbForDatabaseRecords->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $dbForDatabase->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); $queueForDatabase ->setType(DATABASE_TYPE_DELETE_COLLECTION) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php index 7039e71272..97d07872d3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Decrement.php @@ -77,13 +77,13 @@ class Decrement extends Action ->param('min', null, new Numeric(), 'Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, string $attribute, int|float $value, int|float|null $min, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, string $attribute, int|float $value, int|float|null $min, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents, StatsUsage $queueForStatsUsage): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -95,8 +95,10 @@ class Decrement extends Action throw new Exception($this->getParentNotFoundException()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + try { - $document = $dbForDatabaseRecords->decreaseDocumentAttribute( + $document = $dbForDatabase->decreaseDocumentAttribute( collection: 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), id: $documentId, attribute: $attribute, diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php index 27158fd9c5..ba944f4e03 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Attribute/Increment.php @@ -77,13 +77,13 @@ class Increment extends Action ->param('max', null, new Numeric(), 'Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, string $attribute, int|float $value, int|float|null $max, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, string $attribute, int|float $value, int|float|null $max, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents, StatsUsage $queueForStatsUsage): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -95,8 +95,10 @@ class Increment extends Action throw new Exception($this->getParentNotFoundException()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + try { - $document = $dbForDatabaseRecords->increaseDocumentAttribute( + $document = $dbForDatabase->increaseDocumentAttribute( collection: 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), id: $documentId, attribute: $attribute, @@ -105,7 +107,7 @@ class Increment extends Action ); } catch (ConflictException) { throw new Exception($this->getConflictException()); - } catch (NotFoundException $e) { + } catch (NotFoundException) { throw new Exception($this->getStructureNotFoundException()); } catch (LimitException) { throw new Exception($this->getLimitException(), $this->getSdkNamespace() . ' "' . $attribute . '" has reached the maximum value of ' . $max); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php index 867fecedc6..3781139416 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Delete.php @@ -72,7 +72,7 @@ class Delete extends Action ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') @@ -82,7 +82,7 @@ class Delete extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void { $database = $dbForProject->getDocument('databases', $databaseId); if ($database->isEmpty()) { @@ -109,10 +109,12 @@ class Delete extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $documents = []; try { - $modified = $dbForDatabaseRecords->deleteDocuments( + $modified = $dbForDatabase->deleteDocuments( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries, onNext: function (Document $document) use ($plan, &$documents) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php index 0ce968bd31..852610bbc2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Update.php @@ -76,7 +76,7 @@ class Update extends Action ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') @@ -86,7 +86,7 @@ class Update extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string|array $data, array $queries, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, string|array $data, array $queries, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void { $data = \is_string($data) ? \json_decode($data, true) @@ -130,11 +130,13 @@ class Update extends Action $data = $this->removeReadonlyAttributes($data, privileged: true); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $documents = []; try { - $modified = $dbForDatabaseRecords->withPreserveDates(function () use ($plan, &$documents, $dbForDatabaseRecords, $database, $collection, $data, $queries) { - return $dbForDatabaseRecords->updateDocuments( + $modified = $dbForDatabase->withPreserveDates(function () use ($plan, &$documents, $dbForDatabase, $database, $collection, $data, $queries) { + return $dbForDatabase->updateDocuments( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), new Document($data), $queries, diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php index fff4cefac5..bba24afe44 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Bulk/Upsert.php @@ -74,7 +74,7 @@ class Upsert extends Action ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of document data as JSON objects. May contain partial documents.', false, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') @@ -84,7 +84,7 @@ class Upsert extends Action ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $documents, UtopiaResponse $response, Database $dbForProject, Database $databasebForDatabaseRecords, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void + public function action(string $databaseId, string $collectionId, array $documents, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, StatsUsage $queueForStatsUsage, Event $queueForEvents, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks, array $plan): void { $database = $dbForProject->getDocument('databases', $databaseId); if ($database->isEmpty()) { @@ -110,11 +110,13 @@ class Upsert extends Action $documents[$key] = new Document($document); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $upserted = []; try { - $modified = $databasebForDatabaseRecords->withPreserveDates(function () use ($databasebForDatabaseRecords, $database, $collection, $documents, $plan, &$upserted) { - return $databasebForDatabaseRecords->upsertDocuments( + $modified = $dbForDatabase->withPreserveDates(function () use ($dbForDatabase, $database, $collection, $documents, $plan, &$upserted) { + return $dbForDatabase->upsertDocuments( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documents, onNext: function (Document $document) use ($plan, &$upserted) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php index 8d4ca593d5..919a5a7a79 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Create.php @@ -121,7 +121,7 @@ class Create extends Action ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of documents data as JSON objects.', true, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('user') ->inject('queueForEvents') ->inject('queueForStatsUsage') @@ -130,7 +130,7 @@ class Create extends Action ->inject('queueForWebhooks') ->callback($this->action(...)); } - public function action(string $databaseId, string $documentId, string $collectionId, string|array $data, ?array $permissions, ?array $documents, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Document $user, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks): void + public function action(string $databaseId, string $documentId, string $collectionId, string|array $data, ?array $permissions, ?array $documents, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Document $user, Event $queueForEvents, StatsUsage $queueForStatsUsage, Event $queueForRealtime, Event $queueForFunctions, Event $queueForWebhooks): void { $data = \is_string($data) ? \json_decode($data, true) @@ -362,11 +362,13 @@ class Create extends Action return $document; }, $documents); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + try { $created = []; - $dbForDatabaseRecords->withPreserveDates( - function () use (&$created, $dbForDatabaseRecords, $database, $collection, $documents) { - $dbForDatabaseRecords->createDocuments( + $dbForDatabase->withPreserveDates( + function () use (&$created, $dbForDatabase, $database, $collection, $documents) { + $dbForDatabase->createDocuments( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documents, onNext: function ($doc) use (&$created) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php index 63303fb175..2088a64541 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Delete.php @@ -74,13 +74,13 @@ class Delete extends Action ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, ?\DateTime $requestTimestamp, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, ?\DateTime $requestTimestamp, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents, StatsUsage $queueForStatsUsage): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); @@ -97,16 +97,18 @@ class Delete extends Action throw new Exception($this->getParentNotFoundException()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + // Read permission should not be required for delete - $document = Authorization::skip(fn () => $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); + $document = Authorization::skip(fn () => $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); if ($document->isEmpty()) { throw new Exception($this->getNotFoundException()); } try { - $dbForDatabaseRecords->withRequestTimestamp($requestTimestamp, function () use ($dbForDatabaseRecords, $database, $collection, $documentId) { - $dbForDatabaseRecords->deleteDocument( + $dbForDatabase->withRequestTimestamp($requestTimestamp, function () use ($dbForDatabase, $database, $collection, $documentId) { + $dbForDatabase->deleteDocument( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId ); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php index ed8d3d50cf..804703dbcd 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Get.php @@ -65,12 +65,12 @@ class Get extends Action ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, array $queries, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, array $queries, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, StatsUsage $queueForStatsUsage): void { $isAPIKey = Auth::isAppUser(Authorization::getRoles()); $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); @@ -82,6 +82,8 @@ class Get extends Action $collection = Authorization::skip(fn () => $dbForProject->getDocument('database_' . $database->getSequence(), $collectionId)); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + if ($collection->isEmpty() || (!$collection->getAttribute('enabled', false) && !$isAPIKey && !$isPrivilegedUser)) { throw new Exception($this->getParentNotFoundException()); } @@ -97,10 +99,10 @@ class Get extends Action if (! empty($selects)) { // has selects, allow relationship on documents! - $document = $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId, $queries); + $document = $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId, $queries); } else { // has no selects, disable relationship looping on documents! - $document = $dbForDatabaseRecords->skipRelationships(fn () => $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId, $queries)); + $document = $dbForDatabase->skipRelationships(fn () => $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId, $queries)); } } catch (QueryException $e) { throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php index a0003006c1..47124e5e1d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Update.php @@ -80,13 +80,13 @@ class Update extends Action ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, string|array $data, ?array $permissions, ?\DateTime $requestTimestamp, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, string|array $data, ?array $permissions, ?\DateTime $requestTimestamp, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents, StatsUsage $queueForStatsUsage): void { $data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array @@ -110,9 +110,11 @@ class Update extends Action throw new Exception($this->getParentNotFoundException()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + // Read permission should not be required for update /** @var Document $document */ - $document = Authorization::skip(fn () => $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); + $document = Authorization::skip(fn () => $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); if ($document->isEmpty()) { throw new Exception($this->getNotFoundException()); @@ -233,9 +235,9 @@ class Update extends Action ->addMetric(str_replace('{databaseInternalId}', $database->getSequence(), METRIC_DATABASE_ID_OPERATIONS_WRITES), $operations); try { - $document = $dbForDatabaseRecords->withRequestTimestamp( + $document = $dbForDatabase->withRequestTimestamp( $requestTimestamp, - fn () => $dbForDatabaseRecords->withPreserveDates(fn () => $dbForDatabaseRecords->updateDocument( + fn () => $dbForDatabase->withPreserveDates(fn () => $dbForDatabase->updateDocument( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $document->getId(), $newDocument diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php index 97e9f70dfe..cff24baec3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/Upsert.php @@ -84,13 +84,13 @@ class Upsert extends Action ->inject('response') ->inject('user') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $documentId, string|array $data, ?array $permissions, ?\DateTime $requestTimestamp, UtopiaResponse $response, Document $user, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, string $documentId, string|array $data, ?array $permissions, ?\DateTime $requestTimestamp, UtopiaResponse $response, Document $user, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents, StatsUsage $queueForStatsUsage): void { $data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array @@ -115,6 +115,8 @@ class Upsert extends Action throw new Exception($this->getParentNotFoundException()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $allowedPermissions = [ Database::PERMISSION_READ, Database::PERMISSION_UPDATE, @@ -125,7 +127,7 @@ class Upsert extends Action // If no permission, upsert permission from the old document if present (update scenario) else add default permission (create scenario) if (\is_null($permissions)) { - $oldDocument = Authorization::skip(fn () => $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); + $oldDocument = Authorization::skip(fn () => $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); if ($oldDocument->isEmpty()) { if (!empty($user->getId())) { $defaultPermissions = []; @@ -166,7 +168,7 @@ class Upsert extends Action $newDocument = new Document($data); $operations = 0; - $setCollection = (function (Document $collection, Document $document) use ($isAPIKey, $isPrivilegedUser, &$setCollection, $dbForProject, $dbForDatabaseRecords, $database, &$operations) { + $setCollection = (function (Document $collection, Document $document) use ($isAPIKey, $isPrivilegedUser, &$setCollection, $dbForProject, $dbForDatabase, $database, &$operations) { $operations++; $relationships = \array_filter( @@ -207,7 +209,7 @@ class Upsert extends Action if ($relation instanceof Document) { $relation = $this->removeReadonlyAttributes($relation, $isAPIKey || $isPrivilegedUser); - $oldDocument = Authorization::skip(fn () => $dbForDatabaseRecords->getDocument( + $oldDocument = Authorization::skip(fn () => $dbForDatabase->getDocument( 'database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence(), $relation->getId() )); @@ -243,8 +245,8 @@ class Upsert extends Action $upserted = []; try { - $dbForDatabaseRecords->withPreserveDates(function () use (&$upserted, $dbForDatabaseRecords, $database, $collection, $newDocument) { - return $dbForDatabaseRecords->upsertDocuments( + $dbForDatabase->withPreserveDates(function () use (&$upserted, $dbForDatabase, $database, $collection, $newDocument) { + return $dbForDatabase->upsertDocuments( 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), [$newDocument], onNext: function (Document $document) use (&$upserted) { @@ -265,7 +267,7 @@ class Upsert extends Action $collectionsCache = []; if (empty($upserted[0])) { - $upserted[0] = $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId); + $upserted[0] = $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId); } $document = $upserted[0]; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php index 7237fb5db1..8181c73ac0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Documents/XList.php @@ -67,12 +67,12 @@ class XList extends Action ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, StatsUsage $queueForStatsUsage): void + public function action(string $databaseId, string $collectionId, array $queries, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, StatsUsage $queueForStatsUsage): void { $isAPIKey = Auth::isAppUser(Authorization::getRoles()); $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); @@ -93,6 +93,8 @@ class XList extends Action throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); } + $dbForDatabase = call_user_func($getDatabaseDB, $database); + /** * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries */ @@ -110,7 +112,7 @@ class XList extends Action $documentId = $cursor->getValue(); - $cursorDocument = Authorization::skip(fn () => $dbForDatabaseRecords->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); + $cursorDocument = Authorization::skip(fn () => $dbForDatabase->getDocument('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $documentId)); if ($cursorDocument->isEmpty()) { $type = ucfirst($this->getContext()); @@ -125,14 +127,14 @@ class XList extends Action if (! empty($selectQueries)) { // has selects, allow relationship on documents - $documents = $dbForDatabaseRecords->find('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries); + $documents = $dbForDatabase->find('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries); } else { // has no selects, disable relationship loading on documents /* @type Document[] $documents */ - $documents = $dbForDatabaseRecords->skipRelationships(fn () => $dbForDatabaseRecords->find('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries)); + $documents = $dbForDatabase->skipRelationships(fn () => $dbForDatabase->find('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries)); } - $total = $dbForDatabaseRecords->count('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries, APP_LIMIT_COUNT); + $total = $dbForDatabase->count('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $queries, APP_LIMIT_COUNT); } catch (OrderException $e) { $documents = $this->isCollectionsAPI() ? 'documents' : 'rows'; $attribute = $this->isCollectionsAPI() ? 'attribute' : 'column'; diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index d69f55a52e..4830bc4444 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -77,13 +77,13 @@ class Create extends Action ->param('lengths', [], new ArrayList(new Nullable(new Integer()), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Length of index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE, optional: true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $key, string $type, array $attributes, array $orders, array $lengths, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, EventDatabase $queueForDatabase, Event $queueForEvents): void + public function action(string $databaseId, string $collectionId, string $key, string $type, array $attributes, array $orders, array $lengths, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, EventDatabase $queueForDatabase, Event $queueForEvents): void { $db = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); @@ -103,7 +103,9 @@ class Create extends Action Query::equal('databaseInternalId', [$db->getSequence()]) ], 61); - $limit = $dbForDatabaseRecords->getLimitForIndexes(); + $dbForDatabase = call_user_func($getDatabaseDB, $db); + + $limit = $dbForDatabase->getLimitForIndexes(); if ($count >= $limit) { throw new Exception($this->getLimitException(), 'Index limit exceeded'); @@ -144,7 +146,7 @@ class Create extends Action ]; $contextType = $this->getParentContext(); - if ($dbForDatabaseRecords->getAdapter()->getSupportForAttributes()) { + if ($dbForDatabase->getAdapter()->getSupportForAttributes()) { foreach ($attributes as $i => $attribute) { // find attribute metadata in collection document $attributeIndex = \array_search($attribute, array_column($oldAttributes, 'key')); @@ -208,9 +210,9 @@ class Create extends Action $supportForSpatialAttributes, $supportForSpatialIndexNull, $supportForSpatialIndexOrder, - $dbForDatabaseRecords->getAdapter()->getSupportForAttributes(), - $dbForDatabaseRecords->getAdapter()->getSupportForMultipleFulltextIndexes(), - $dbForDatabaseRecords->getAdapter()->getSupportForIdenticalIndexes(), + $dbForDatabase->getAdapter()->getSupportForAttributes(), + $dbForDatabase->getAdapter()->getSupportForMultipleFulltextIndexes(), + $dbForDatabase->getAdapter()->getSupportForIdenticalIndexes(), ); if (!$validator->isValid($index)) { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php index fba6cc669a..ab772e1f44 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Update.php @@ -69,12 +69,12 @@ class Update extends Action ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } - public function action(string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords, Event $queueForEvents): void + public function action(string $databaseId, string $collectionId, string $name, ?array $permissions, bool $documentSecurity, bool $enabled, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB, Event $queueForEvents): void { $database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); if ($database->isEmpty()) { @@ -104,7 +104,9 @@ class Update extends Action ->setAttribute('search', \implode(' ', [$collectionId, $name])) ); - $dbForDatabaseRecords->updateCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $permissions, $documentSecurity); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + + $dbForDatabase->updateCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $permissions, $documentSecurity); $queueForEvents ->setContext('database', $database) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php index 4a8213e098..a1451c1b34 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Usage/Get.php @@ -63,15 +63,16 @@ class Get extends Action ->param('collectionId', '', new UID(), 'Collection ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->callback($this->action(...)); } - public function action(string $databaseId, string $range, string $collectionId, UtopiaResponse $response, Database $dbForProject, Database $dbForDatabaseRecords): void + public function action(string $databaseId, string $range, string $collectionId, UtopiaResponse $response, Database $dbForProject, callable $getDatabaseDB): void { $database = $dbForProject->getDocument('databases', $databaseId); $collectionDocument = $dbForProject->getDocument('database_' . $database->getSequence(), $collectionId); - $collection = $dbForDatabaseRecords->getCollection('database_' . $database->getSequence() . '_collection_' . $collectionDocument->getSequence()); + $dbForDatabase = call_user_func($getDatabaseDB, $database); + $collection = $dbForDatabase->getCollection('database_' . $database->getSequence() . '_collection_' . $collectionDocument->getSequence()); if ($collection->isEmpty()) { throw new Exception($this->getNotFoundException()); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php index 3898de9a45..0dbc554358 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php @@ -20,6 +20,7 @@ use Utopia\Database\Exception\Limit as LimitException; use Utopia\Database\Exception\Structure as StructureException; use Utopia\Database\Helpers\ID; use Utopia\Swoole\Response as SwooleResponse; +use Utopia\System\System; use Utopia\Validator\Boolean; use Utopia\Validator\Text; @@ -30,6 +31,25 @@ class Create extends Action return 'createDatabase'; } + protected function getDatabaseDSN(): string + { + $database = System::getEnv('_APP_DATABASE_NAME', 'appwrite'); + $namespace = System::getEnv('_APP_DATABASE_SHARED_NAMESPACE', ''); + + $schema = match ($this->getDatabaseType()) { + 'documentsdb' => System::getEnv('_APP_DB_HOST_DOCUMENTSDB', 'mongodb'), + default => System::getEnv('_APP_DB_HOST', 'mariadb'), + }; + + $dsn = $schema . '://' . $database; + + if (!empty($namespace)) { + $dsn .= '?namespace=' . $namespace; + } + + return $dsn; + } + public function __construct() { $this diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php index b1bf506b20..754f59a60c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Create.php @@ -42,7 +42,7 @@ class Create extends CollectionCreate ->label('sdk', new Method( namespace: 'documentsdb', group: 'collections', - name: self::getName(), + name: 'createCollection', description: '/docs/references/documentsdb/create-collection.md', auth: [AuthType::KEY], responses: [ @@ -61,7 +61,7 @@ class Create extends CollectionCreate ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php index ce158c76a7..7ada00c851 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Delete.php @@ -38,7 +38,7 @@ class Delete extends CollectionDelete ->label('sdk', new Method( namespace: 'documentsdb', group: 'collections', - name: self::getName(), + name: 'deleteCollection', description: '/docs/references/documentsdb/delete-collection.md', auth: [AuthType::KEY], responses: [ @@ -53,7 +53,7 @@ class Delete extends CollectionDelete ->param('collectionId', '', new UID(), 'Collection ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php index 9e4b61565c..9e7965adec 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Decrement.php @@ -62,7 +62,7 @@ class Decrement extends DecrementDocumentAttribute ->param('min', null, new Numeric(), 'Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php index b5d87dd5f6..b29558f738 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Attribute/Increment.php @@ -62,7 +62,7 @@ class Increment extends IncrementDocumentAttribute ->param('max', null, new Numeric(), 'Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php index 438a81215b..25d24fa88c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Delete.php @@ -58,7 +58,7 @@ class Delete extends DocumentsDelete ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php index bff71f231c..6caa73df2b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Update.php @@ -60,7 +60,7 @@ class Update extends DocumentsUpdate ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php index 8138e7220f..e7282326ed 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Bulk/Upsert.php @@ -60,7 +60,7 @@ class Upsert extends DocumentsUpsert ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of document data as JSON objects. May contain partial documents.', false, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php index 110b321f73..ba72e8e475 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Create.php @@ -100,7 +100,7 @@ class Create extends DocumentCreate ->param('documents', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of documents data as JSON objects.', true, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('user') ->inject('queueForEvents') ->inject('queueForStatsUsage') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php index 991fda0512..0d5df96272 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Delete.php @@ -64,7 +64,7 @@ class Delete extends DocumentDelete ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Get.php index b9db251031..44b4a5b36c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Get.php @@ -54,7 +54,7 @@ class Get extends DocumentGet ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php index f3ee554185..2460552998 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Update.php @@ -63,7 +63,7 @@ class Update extends DocumentUpdate ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php index 0c23fbe98f..6098652a21 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/Upsert.php @@ -66,7 +66,7 @@ class Upsert extends DocumentUpsert ->inject('response') ->inject('user') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/XList.php index 73aa6e9931..d8afe1f81a 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Documents/XList.php @@ -53,7 +53,7 @@ class XList extends DocumentXList ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Get.php index d350117988..ced946b89e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Get.php @@ -35,7 +35,7 @@ class Get extends CollectionGet ->label('sdk', new Method( namespace: 'documentsdb', group: 'collections', - name: self::getName(), + name: 'getCollection', description: '/docs/references/documentsdb/get-collection.md', auth: [AuthType::KEY], responses: [ diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php index 1425bbf1b7..6ce59d78c7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php @@ -64,7 +64,7 @@ class Create extends IndexCreate ->param('lengths', [], new ArrayList(new Nullable(new Integer()), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Length of index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE, optional: true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php index 9961c40463..df8110e2a1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Update.php @@ -41,7 +41,7 @@ class Update extends CollectionUpdate ->label('sdk', new Method( namespace: 'documentsdb', group: 'collections', - name: self::getName(), + name: 'updateCollection', description: '/docs/references/documentsdb/update-collection.md', auth: [AuthType::KEY], responses: [ @@ -60,7 +60,7 @@ class Update extends CollectionUpdate ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Usage/Get.php index 1c49129864..71812a2f76 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Usage/Get.php @@ -52,7 +52,7 @@ class Get extends CollectionUsageGet ->param('collectionId', '', new UID(), 'Collection ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/XList.php index ea4a502dd4..3f8b02ab2e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/XList.php @@ -37,7 +37,7 @@ class XList extends CollectionXList ->label('sdk', new Method( namespace: 'documentsdb', group: 'collections', - name: self::getName(), + name: 'listCollections', description: '/docs/references/documentsdb/list-collections.md', auth: [AuthType::KEY], responses: [ diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php index 37e82287fe..bce62e9219 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php @@ -61,7 +61,7 @@ class Create extends CollectionCreate ->param('enabled', true, new Boolean(), 'Is table enabled? When set to \'disabled\', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php index f07b14479b..5858ce0df8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php @@ -53,7 +53,7 @@ class Delete extends CollectionDelete ->param('tableId', '', new UID(), 'Table ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php index 7c81866335..c5428a473d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Indexes/Create.php @@ -64,7 +64,7 @@ class Create extends IndexCreate ->param('lengths', [], new ArrayList(new Nullable(new Integer()), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Length of index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE, optional: true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForDatabase') ->inject('queueForEvents') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php index fbf874b9bb..0bd1018e6e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Delete.php @@ -58,7 +58,7 @@ class Delete extends DocumentsDelete ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php index 570f1e1cf0..92878b4155 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Update.php @@ -60,7 +60,7 @@ class Update extends DocumentsUpdate ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php index 853918482e..dd88a6444e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php @@ -60,7 +60,7 @@ class Upsert extends DocumentsUpsert ->param('rows', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of row data as JSON objects. May contain partial rows.', false, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->inject('queueForEvents') ->inject('queueForRealtime') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php index a0988ff8b5..fb8d5b65a7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Decrement.php @@ -62,7 +62,7 @@ class Decrement extends DecrementDocumentAttribute ->param('min', null, new Numeric(), 'Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php index e36d03fff6..b67ad8662e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Column/Increment.php @@ -62,7 +62,7 @@ class Increment extends IncrementDocumentAttribute ->param('max', null, new Numeric(), 'Maximum value for the column. If the current value is greater than this value, an error will be thrown.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php index 18c58cea4e..2bc8d31c07 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Create.php @@ -100,7 +100,7 @@ class Create extends DocumentCreate ->param('rows', [], fn (array $plan) => new ArrayList(new JSON(), $plan['databasesBatchSize'] ?? APP_LIMIT_DATABASE_BATCH), 'Array of rows data as JSON objects.', true, ['plan']) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('user') ->inject('queueForEvents') ->inject('queueForStatsUsage') diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php index 22a4c901d7..f8203ce7e7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Delete.php @@ -64,7 +64,7 @@ class Delete extends DocumentDelete ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php index e68c5313f5..d24b8fdee0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Get.php @@ -54,7 +54,7 @@ class Get extends DocumentGet ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php index 5be8d3b45e..e95774783c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Update.php @@ -63,7 +63,7 @@ class Update extends DocumentUpdate ->inject('requestTimestamp') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php index e945670da5..c8bdc740be 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php @@ -66,7 +66,7 @@ class Upsert extends DocumentUpsert ->inject('response') ->inject('user') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->inject('queueForStatsUsage') ->callback($this->action(...)); diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php index 85b88b148b..9c46bda601 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Rows/XList.php @@ -53,7 +53,7 @@ class XList extends DocumentXList ->param('queries', [], new ArrayList(new Text(APP_LIMIT_ARRAY_ELEMENT_SIZE), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForStatsUsage') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php index 62333ba8ae..dbec0130e8 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -60,7 +60,7 @@ class Update extends CollectionUpdate ->param('enabled', true, new Boolean(), 'Is table enabled? When set to \'disabled\', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.', true) ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->inject('queueForEvents') ->callback($this->action(...)); } diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php index c50d0b01bc..bb97fc35c3 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Usage/Get.php @@ -52,7 +52,7 @@ class Get extends CollectionUsageGet ->param('tableId', '', new UID(), 'Table ID.') ->inject('response') ->inject('dbForProject') - ->inject('dbForDatabaseRecords') + ->inject('getDatabaseDB') ->callback($this->action(...)); } } diff --git a/src/Appwrite/Platform/Modules/Databases/Services/Http.php b/src/Appwrite/Platform/Modules/Databases/Services/Http.php index e738b9aa65..f0bcaf68a0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Services/Http.php +++ b/src/Appwrite/Platform/Modules/Databases/Services/Http.php @@ -6,7 +6,7 @@ use Appwrite\Platform\Modules\Databases\Http\Init\Timeout; use Appwrite\Platform\Modules\Databases\Services\Registry\Collections as CollectionsRegistry; use Appwrite\Platform\Modules\Databases\Services\Registry\Databases as DatabasesRegistry; use Appwrite\Platform\Modules\Databases\Services\Registry\DocumentsDB as DocumentsDBRegistry; -use Appwrite\Platform\Modules\Databases\Services\Registry\Tables as TablesRegistry; +use Appwrite\Platform\Modules\Databases\Services\Registry\TablesDB as TablesDBRegistry; use Utopia\Platform\Service; class Http extends Service @@ -20,7 +20,7 @@ class Http extends Service foreach ([ DatabasesRegistry::class, CollectionsRegistry::class, - TablesRegistry::class, + TablesDBRegistry::class, DocumentsDBRegistry::class ] as $registrar) { new $registrar($this); diff --git a/src/Appwrite/Platform/Modules/Databases/Services/Registry/Tables.php b/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php similarity index 99% rename from src/Appwrite/Platform/Modules/Databases/Services/Registry/Tables.php rename to src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php index d570745148..11be613629 100644 --- a/src/Appwrite/Platform/Modules/Databases/Services/Registry/Tables.php +++ b/src/Appwrite/Platform/Modules/Databases/Services/Registry/TablesDB.php @@ -72,7 +72,7 @@ use Utopia\Platform\Service; * - Columns * - Column-Indexes */ -class Tables extends Base +class TablesDB extends Base { protected function register(Service $service): void {