From f090a23bc3b40c0f4eefefda1e2d761c2516ea44 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 07:44:29 +0530 Subject: [PATCH 01/24] feat: allow HEAD requests in function executions --- app/config/specs/open-api3-1.8.x-client.json | 3 ++- app/config/specs/open-api3-1.8.x-console.json | 3 ++- app/config/specs/open-api3-1.8.x-server.json | 3 ++- app/config/specs/open-api3-latest-client.json | 3 ++- app/config/specs/open-api3-latest-console.json | 3 ++- app/config/specs/open-api3-latest-server.json | 3 ++- app/config/specs/swagger2-1.8.x-client.json | 3 ++- app/config/specs/swagger2-1.8.x-console.json | 3 ++- app/config/specs/swagger2-1.8.x-server.json | 3 ++- app/config/specs/swagger2-latest-client.json | 3 ++- app/config/specs/swagger2-latest-console.json | 3 ++- app/config/specs/swagger2-latest-server.json | 3 ++- .../Platform/Modules/Functions/Http/Executions/Create.php | 2 +- 13 files changed, 25 insertions(+), 13 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 5d80f25da5..97dd04e518 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -5889,7 +5889,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 3013857712..6058252ac7 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -12799,7 +12799,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index ce383d596c..4559eb972d 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -11584,7 +11584,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 5d80f25da5..97dd04e518 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -5889,7 +5889,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 3013857712..6058252ac7 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -12799,7 +12799,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index ce383d596c..4559eb972d 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -11584,7 +11584,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index de6564edaa..e512273091 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -5987,7 +5987,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index c247b9d63d..6285e8a487 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -12845,7 +12845,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index aac613600e..cfe7109ed4 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -11655,7 +11655,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index de6564edaa..e512273091 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -5987,7 +5987,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index c247b9d63d..6285e8a487 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -12845,7 +12845,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index aac613600e..cfe7109ed4 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -11655,7 +11655,8 @@ "PUT", "PATCH", "DELETE", - "OPTIONS" + "OPTIONS", + "HEAD" ], "x-enum-name": "ExecutionMethod", "x-enum-keys": [] diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php index 64056b7db7..ef5be61384 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -80,7 +80,7 @@ class Create extends Base ->param('body', '', new Text(10485760, 0), 'HTTP body of execution. Default value is empty string.', true) ->param('async', false, new Boolean(true), 'Execute code in the background. Default value is false.', true) ->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true) - ->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true) + ->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'], true), 'HTTP method of execution. Default value is GET.', true) ->param('headers', [], new AnyOf([new Assoc(), new Text(65535)], AnyOf::TYPE_MIXED), 'HTTP headers of execution. Defaults to empty.', true) ->param('scheduledAt', null, new Text(100), 'Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.', true) ->inject('response') From cc736218747428b5b28b0cf3d6fc2a48b8d9e080 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 07:46:35 +0530 Subject: [PATCH 02/24] format --- src/Appwrite/Utopia/Request/Filters/V20.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Request/Filters/V20.php b/src/Appwrite/Utopia/Request/Filters/V20.php index 939eeeabe7..30de1fb2d3 100644 --- a/src/Appwrite/Utopia/Request/Filters/V20.php +++ b/src/Appwrite/Utopia/Request/Filters/V20.php @@ -52,7 +52,7 @@ class V20 extends Filter if (empty($selections)) { $hasWildcard = true; $parsed[] = Query::select(['*']); - } else if (!$hasWildcard) { + } elseif (!$hasWildcard) { // check if any select includes a wildcard as we added one above foreach ($selections as $select) { if (\in_array('*', $select->getValues(), true)) { From c6c3a675d235f4a4ab0817ad86aff2cee25b166d Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 15:20:20 +0530 Subject: [PATCH 03/24] update specs --- app/config/specs/open-api3-1.8.x-client.json | 2 +- app/config/specs/open-api3-1.8.x-console.json | 2 +- app/config/specs/open-api3-1.8.x-server.json | 2 +- app/config/specs/open-api3-latest-client.json | 2 +- app/config/specs/open-api3-latest-console.json | 2 +- app/config/specs/open-api3-latest-server.json | 2 +- app/config/specs/swagger2-1.8.x-client.json | 2 +- app/config/specs/swagger2-1.8.x-console.json | 2 +- app/config/specs/swagger2-1.8.x-server.json | 2 +- app/config/specs/swagger2-latest-client.json | 2 +- app/config/specs/swagger2-latest-console.json | 2 +- app/config/specs/swagger2-latest-server.json | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 6cea7c5ef3..553b7ce385 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -5881,7 +5881,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index a5b0679437..7d33440d01 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -12791,7 +12791,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 923ff81974..d117377a21 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -11576,7 +11576,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 6cea7c5ef3..553b7ce385 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -5881,7 +5881,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index a5b0679437..7d33440d01 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -12791,7 +12791,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 923ff81974..d117377a21 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -11576,7 +11576,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index 92950a9cee..9b9a695896 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -5978,7 +5978,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index b6c848bd0c..d8fc57519f 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -12836,7 +12836,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 4b0a1263e5..f9c84e4f2d 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -11646,7 +11646,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 92950a9cee..9b9a695896 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -5978,7 +5978,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index b6c848bd0c..d8fc57519f 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -12836,7 +12836,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 4b0a1263e5..f9c84e4f2d 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -11646,7 +11646,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ From f4ea5fad4ad0b140c51c89d6d617ff8d123effa3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 17:22:08 +0530 Subject: [PATCH 04/24] add test case --- .../Functions/FunctionsCustomServerTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 916e41d8a4..751df5c65f 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -925,6 +925,19 @@ class FunctionsCustomServerTest extends Scope $executionId = $execution['body']['$id'] ?? ''; + /** Test create execution with HEAD method */ + $execution = $this->createExecution($data['functionId'], [ + 'async' => 'false', + 'method' => 'HEAD', + ]); + + $this->assertEquals(200, $execution['headers']['status-code']); + $this->assertEquals('completed', $execution['body']['status']); + $this->assertEquals(200, $execution['body']['responseStatusCode']); + $this->assertIsArray($execution['body']['responseHeaders']); + $this->assertEmpty($execution['body']['responseBody']); // For head requests, response body is empty + + /** Test create execution with 400 status code */ $execution = $this->createExecution($data['functionId'], [ 'async' => 'false', 'path' => '/?code=400' From 3fc53b2c434f793624630d5a8af2c57b3dde66cf Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 27 Aug 2025 23:59:40 +1200 Subject: [PATCH 05/24] Fix request filter for nested relationships --- composer.lock | 12 +-- src/Appwrite/Utopia/Request/Filters/V20.php | 86 +++++++++++++-------- 2 files changed, 60 insertions(+), 38 deletions(-) diff --git a/composer.lock b/composer.lock index 077f5204d1..3bf17bc228 100644 --- a/composer.lock +++ b/composer.lock @@ -3557,16 +3557,16 @@ }, { "name": "utopia-php/database", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "99beaf1dd6dc3561c8332f9893325777553644a4" + "reference": "8a536fead840d9da6ee819fe6b80e0f047997f69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/99beaf1dd6dc3561c8332f9893325777553644a4", - "reference": "99beaf1dd6dc3561c8332f9893325777553644a4", + "url": "https://api.github.com/repos/utopia-php/database/zipball/8a536fead840d9da6ee819fe6b80e0f047997f69", + "reference": "8a536fead840d9da6ee819fe6b80e0f047997f69", "shasum": "" }, "require": { @@ -3607,9 +3607,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/1.2.1" + "source": "https://github.com/utopia-php/database/tree/1.2.3" }, - "time": "2025-08-26T16:05:26+00:00" + "time": "2025-08-27T11:47:04+00:00" }, { "name": "utopia-php/detector", diff --git a/src/Appwrite/Utopia/Request/Filters/V20.php b/src/Appwrite/Utopia/Request/Filters/V20.php index 2683d600ef..d6e95ec327 100644 --- a/src/Appwrite/Utopia/Request/Filters/V20.php +++ b/src/Appwrite/Utopia/Request/Filters/V20.php @@ -32,59 +32,67 @@ class V20 extends Filter */ protected function manageSelectQueries(array $content): array { - $hasWildcard = false; if (!isset($content['queries'])) { - $hasWildcard = true; - // only query, make it json encoded! - $content['queries'] = [Query::select(['*'])->toString()]; + $content['queries'] = []; + } + + // Handle case where queries is an array but empty + if (\is_array($content['queries'])) { + $content['queries'] = \array_filter($content['queries'], function($q) { + if (\is_object($q) && empty((array)$q)) { + return false; + } + if (\is_string($q) && \trim($q) === '') { + return false; + } + if (empty($q)) { + return false; + } + return true; + }); } try { $parsed = Query::parseQueries($content['queries']); } catch (QueryException) { - // don't crash! return $content; } $selections = Query::groupByType($parsed)['selections'] ?? []; - - // If there are no select queries at all, add wildcard - if (empty($selections)) { - $hasWildcard = true; - $parsed[] = Query::select(['*']); - } elseif (!$hasWildcard) { - // check if any select includes a wildcard as we added one above + + // Check if we need to add wildcard + relationships + // This happens when: + // 1. No select queries exist, OR + // 2. A wildcard select exists + $needsRelationships = empty($selections); + if (!$needsRelationships) { foreach ($selections as $select) { if (\in_array('*', $select->getValues(), true)) { - $hasWildcard = true; + $needsRelationships = true; break; } } } /** - * Add `keys.*` for all model types! + * Add wildcard and relationship selects for backward compatibility */ - if ($hasWildcard) { + if ($needsRelationships) { $relatedKeys = $this->getRelatedCollectionKeys(); + $selects = \array_values(\array_unique(\array_merge(['*'], $relatedKeys))); - if (! empty($relatedKeys)) { - $selects = \array_values(\array_unique(\array_merge(['*'], $relatedKeys))); + // Remove any existing select queries + $parsed = \array_filter( + $parsed, + fn ($query) => $query->getMethod() !== Query::TYPE_SELECT + ); - // remove previous select queries - $parsed = \array_filter( - $parsed, - fn ($query) => $query->getMethod() !== Query::TYPE_SELECT - ); - - // add wildcard + relationship(s) selects - $parsed[] = Query::select($selects); - } + // Add wildcard + relationship(s) selects + $parsed[] = Query::select($selects); } $resolvedQueries = []; foreach ($parsed as $query) { - // make em json encoded! $resolvedQueries[] = $query->toString(); } @@ -95,12 +103,15 @@ class V20 extends Filter /** * Returns all relationship attribute keys in `key.*` format for use with `Query::select`. + * Recursively includes nested relationships up to 3 levels deep. + * Prevents infinite loops by tracking all visited collections in the current path. */ private function getRelatedCollectionKeys( ?string $databaseId = null, ?string $collectionId = null, ?string $prefix = null, int $depth = 1, + array $visited = [] ): array { $databaseId ??= $this->getParamValue('databaseId'); $collectionId ??= $this->getParamValue('collectionId'); @@ -112,6 +123,13 @@ class V20 extends Filter ) { return []; } + + // Check if we've already visited this collection in the current path to prevent cycles + if (in_array($collectionId, $visited)) { + return []; + } + + $visited[] = $collectionId; $dbForProject = $this->getDbForProject(); if ($dbForProject === null) { @@ -144,23 +162,27 @@ class V20 extends Filter $key = $attr['key']; $fullKey = $prefix ? $prefix . '.' . $key : $key; + $relatedCollectionId = $attr['relatedCollection'] ?? null; + + // Skip this relationship entirely if it points to an already visited collection + if ($relatedCollectionId && in_array($relatedCollectionId, $visited)) { + continue; + } // Add the wildcard select for this relationship $relationshipKeys[] = $fullKey . '.*'; - // Get the related collection for nested relationships - $relatedCollectionId = $attr['relatedCollection'] ?? null; - + // Continue recursively if we have a related collection if ($relatedCollectionId) { - // Recursively get nested relationship keys $nestedKeys = $this->getRelatedCollectionKeys( $databaseId, $relatedCollectionId, $fullKey, $depth + 1, + $visited ); - $relationshipKeys = \array_merge($relationshipKeys, $nestedKeys); + \array_push($relationshipKeys, ...$nestedKeys); } } From a2eec2eac63e99bc1de0fbd4d66db1d2a416ac55 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 17:30:24 +0530 Subject: [PATCH 06/24] fix: 201 --- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 751df5c65f..adc6c42994 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -931,7 +931,7 @@ class FunctionsCustomServerTest extends Scope 'method' => 'HEAD', ]); - $this->assertEquals(200, $execution['headers']['status-code']); + $this->assertEquals(201, $execution['headers']['status-code']); $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertIsArray($execution['body']['responseHeaders']); From ee292d04a6b199da4f699357cf529fce4751b6f3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 17:32:21 +0530 Subject: [PATCH 07/24] delete execution --- .../Services/Functions/FunctionsCustomServerTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index adc6c42994..220ffb3cdb 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -935,7 +935,14 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertIsArray($execution['body']['responseHeaders']); - $this->assertEmpty($execution['body']['responseBody']); // For head requests, response body is empty + $this->assertEmpty($execution['body']['responseBody']); // For HEAD requests, response body is empty + + /** Delete execution */ + $execution = $this->client->call(Client::METHOD_DELETE, '/functions/' . $data['functionId'] . '/executions/' . $execution['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + $this->assertEquals(204, $execution['headers']['status-code']); /** Test create execution with 400 status code */ $execution = $this->createExecution($data['functionId'], [ @@ -947,11 +954,11 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(400, $execution['body']['responseStatusCode']); + /** Delete execution */ $execution = $this->client->call(Client::METHOD_DELETE, '/functions/' . $data['functionId'] . '/executions/' . $execution['body']['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), []); - $this->assertEquals(204, $execution['headers']['status-code']); return array_merge($data, ['executionId' => $executionId]); From 146252243877464127c4c1ef3492c0bf2bbd14f2 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 28 Aug 2025 00:04:25 +1200 Subject: [PATCH 08/24] Remove logging --- app/controllers/shared/api.php | 6 ------ .../Platform/Modules/Databases/Workers/Databases.php | 8 -------- 2 files changed, 14 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 40eddf574f..7742aac18f 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -810,12 +810,6 @@ App::shutdown() } if (!empty($queueForDatabase->getType())) { - Console::info("Triggering database event: \n" . \json_encode([ - 'projectId' => $project->getId(), - 'databaseId' => $queueForDatabase->getDatabase()?->getId(), - 'tableId' => $queueForDatabase->getTable()?->getId() ?? $queueForDatabase->getCollection()?->getId(), - 'rowId' => $queueForDatabase->getRow()?->getId() ?? $queueForDatabase->getDocument()?->getId(), - ])); $queueForDatabase->trigger(); } diff --git a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php index 22f1e6a2f2..9a98d77d2d 100644 --- a/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php +++ b/src/Appwrite/Platform/Modules/Databases/Workers/Databases.php @@ -64,14 +64,6 @@ class Databases extends Action $collection = new Document($payload['table'] ?? $payload['collection'] ?? []); $database = new Document($payload['database'] ?? []); - Console::info("Processing database operation: \n" . \json_encode([ - 'type' => $type, - 'projectId' => $project->getId(), - 'databaseId' => $database->getId(), - 'collectionId' => $collection->getId(), - 'documentId' => $document->getId(), - ], JSON_PRETTY_PRINT)); - $log->addTag('projectId', $project->getId()); $log->addTag('type', $type); From 66f541092d84b90eda3dfc652843dcb6be1d4be4 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 28 Aug 2025 00:04:32 +1200 Subject: [PATCH 09/24] Update desc --- .../Databases/Http/Databases/Collections/Documents/Upsert.php | 2 +- .../Modules/Databases/Http/TablesDB/Tables/Rows/Upsert.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 8427ee6cd2..6027a20c41 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 @@ -45,7 +45,7 @@ class Upsert extends Action $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/documents/:documentId') - ->desc('Create or update a document') + ->desc('Upsert a document') ->groups(['api', 'database']) ->label('event', 'databases.[databaseId].collections.[collectionId].documents.[documentId].upsert') ->label('scope', 'documents.write') 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 36ca9709e1..c2695379e3 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 @@ -31,7 +31,7 @@ class Upsert extends DocumentUpsert $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/rows/:rowId') - ->desc('Create or update a row') + ->desc('Upsert a row') ->groups(['api', 'database']) ->label('event', 'databases.[databaseId].tables.[tableId].rows.[rowId].upsert') ->label('scope', ['rows.write', 'documents.write']) From 369c19039c3bec79ce0d6343e74be2ba0b0f7b6d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 28 Aug 2025 00:04:40 +1200 Subject: [PATCH 10/24] Update specs --- app/config/specs/open-api3-1.8.x-client.json | 6 +++--- app/config/specs/open-api3-1.8.x-console.json | 6 +++--- app/config/specs/open-api3-1.8.x-server.json | 6 +++--- app/config/specs/open-api3-latest-client.json | 6 +++--- app/config/specs/open-api3-latest-console.json | 6 +++--- app/config/specs/open-api3-latest-server.json | 6 +++--- app/config/specs/swagger2-1.8.x-client.json | 6 +++--- app/config/specs/swagger2-1.8.x-console.json | 6 +++--- app/config/specs/swagger2-1.8.x-server.json | 6 +++--- app/config/specs/swagger2-latest-client.json | 6 +++--- app/config/specs/swagger2-latest-console.json | 6 +++--- app/config/specs/swagger2-latest-server.json | 6 +++--- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 1ccf7d82ab..21ab718af8 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -5146,7 +5146,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -5881,7 +5881,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -7799,7 +7799,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index cd2bb95ee6..8b894e8a55 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -9360,7 +9360,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -12791,7 +12791,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -36594,7 +36594,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 7e5847f94c..0a40b8d604 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -8842,7 +8842,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -11576,7 +11576,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -26959,7 +26959,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 1ccf7d82ab..21ab718af8 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -5146,7 +5146,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -5881,7 +5881,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -7799,7 +7799,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index cd2bb95ee6..8b894e8a55 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -9360,7 +9360,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -12791,7 +12791,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -36594,7 +36594,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 7e5847f94c..0a40b8d604 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -8842,7 +8842,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "tags": [ "databases" @@ -11576,7 +11576,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "x-example": "GET", "enum": [ "GET", @@ -26959,7 +26959,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "tags": [ "tablesDB" diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index b08d8b0036..f634c5d9b8 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -5273,7 +5273,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -5978,7 +5978,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -7866,7 +7866,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index b4dfbb8ca6..9d5ba54989 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -9462,7 +9462,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -12836,7 +12836,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -36701,7 +36701,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 2c358475f8..8bb0e09666 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -8934,7 +8934,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -11646,7 +11646,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -27126,7 +27126,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index b08d8b0036..f634c5d9b8 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -5273,7 +5273,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -5978,7 +5978,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -7866,7 +7866,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index b4dfbb8ca6..9d5ba54989 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -9462,7 +9462,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -12836,7 +12836,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -36701,7 +36701,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 2c358475f8..8bb0e09666 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -8934,7 +8934,7 @@ ] }, "put": { - "summary": "Create or update a document", + "summary": "Upsert a document", "operationId": "databasesUpsertDocument", "consumes": [ "application\/json" @@ -11646,7 +11646,7 @@ }, "method": { "type": "string", - "description": "HTTP method of execution. Default value is GET.", + "description": "HTTP method of execution. Default value is POST.", "default": "POST", "x-example": "GET", "enum": [ @@ -27126,7 +27126,7 @@ ] }, "put": { - "summary": "Create or update a row", + "summary": "Upsert a row", "operationId": "tablesDBUpsertRow", "consumes": [ "application\/json" From 75a1e5ca4ad6957223cc8e024e4badc0f70a7af4 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 28 Aug 2025 00:12:00 +1200 Subject: [PATCH 11/24] Format --- src/Appwrite/Utopia/Request/Filters/V20.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Request/Filters/V20.php b/src/Appwrite/Utopia/Request/Filters/V20.php index d6e95ec327..3c605b0248 100644 --- a/src/Appwrite/Utopia/Request/Filters/V20.php +++ b/src/Appwrite/Utopia/Request/Filters/V20.php @@ -38,7 +38,7 @@ class V20 extends Filter // Handle case where queries is an array but empty if (\is_array($content['queries'])) { - $content['queries'] = \array_filter($content['queries'], function($q) { + $content['queries'] = \array_filter($content['queries'], function ($q) { if (\is_object($q) && empty((array)$q)) { return false; } @@ -59,7 +59,7 @@ class V20 extends Filter } $selections = Query::groupByType($parsed)['selections'] ?? []; - + // Check if we need to add wildcard + relationships // This happens when: // 1. No select queries exist, OR @@ -123,7 +123,7 @@ class V20 extends Filter ) { return []; } - + // Check if we've already visited this collection in the current path to prevent cycles if (in_array($collectionId, $visited)) { return []; @@ -163,7 +163,7 @@ class V20 extends Filter $key = $attr['key']; $fullKey = $prefix ? $prefix . '.' . $key : $key; $relatedCollectionId = $attr['relatedCollection'] ?? null; - + // Skip this relationship entirely if it points to an already visited collection if ($relatedCollectionId && in_array($relatedCollectionId, $visited)) { continue; From 61e0e74b56e9f9a0cf13e8090673c600cee7618e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 28 Aug 2025 00:47:05 +1200 Subject: [PATCH 12/24] Update src/Appwrite/Utopia/Request/Filters/V20.php Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/Appwrite/Utopia/Request/Filters/V20.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Utopia/Request/Filters/V20.php b/src/Appwrite/Utopia/Request/Filters/V20.php index 3c605b0248..c8622f8b7a 100644 --- a/src/Appwrite/Utopia/Request/Filters/V20.php +++ b/src/Appwrite/Utopia/Request/Filters/V20.php @@ -182,7 +182,7 @@ class V20 extends Filter $visited ); - \array_push($relationshipKeys, ...$nestedKeys); + $relationshipKeys = \array_merge($relationshipKeys, $nestedKeys); } } From e2dcc49fa9bb57874b48516d1c6c063ef912b91a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 18:51:52 +0530 Subject: [PATCH 13/24] chore: update tables group in specs --- app/config/specs/open-api3-1.8.x-console.json | 10 +++++----- app/config/specs/open-api3-1.8.x-server.json | 10 +++++----- app/config/specs/open-api3-latest-console.json | 10 +++++----- app/config/specs/open-api3-latest-server.json | 10 +++++----- app/config/specs/swagger2-1.8.x-console.json | 10 +++++----- app/config/specs/swagger2-1.8.x-server.json | 10 +++++----- app/config/specs/swagger2-latest-console.json | 10 +++++----- app/config/specs/swagger2-latest-server.json | 10 +++++----- .../Modules/Databases/Http/TablesDB/Tables/Create.php | 2 +- .../Modules/Databases/Http/TablesDB/Tables/Delete.php | 2 +- .../Modules/Databases/Http/TablesDB/Tables/Get.php | 2 +- .../Modules/Databases/Http/TablesDB/Tables/Update.php | 2 +- .../Modules/Databases/Http/TablesDB/Tables/XList.php | 2 +- 13 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 9b17bb4307..222ab3cf28 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -32446,7 +32446,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -32532,7 +32532,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -32639,7 +32639,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -32711,7 +32711,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -32813,7 +32813,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 1bbc0c7554..fb28f71d32 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -22853,7 +22853,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -22940,7 +22940,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -23048,7 +23048,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -23121,7 +23121,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -23224,7 +23224,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 9b17bb4307..222ab3cf28 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -32446,7 +32446,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -32532,7 +32532,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -32639,7 +32639,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -32711,7 +32711,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -32813,7 +32813,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 1bbc0c7554..fb28f71d32 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -22853,7 +22853,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -22940,7 +22940,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -23048,7 +23048,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -23121,7 +23121,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -23224,7 +23224,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index ba78f719a8..8695414255 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -32628,7 +32628,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -32711,7 +32711,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -32819,7 +32819,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -32889,7 +32889,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -32993,7 +32993,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 9d3673333d..1834228381 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -23090,7 +23090,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -23174,7 +23174,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -23283,7 +23283,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -23354,7 +23354,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -23459,7 +23459,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index ba78f719a8..8695414255 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -32628,7 +32628,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -32711,7 +32711,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -32819,7 +32819,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -32889,7 +32889,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -32993,7 +32993,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 9d3673333d..1834228381 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -23090,7 +23090,7 @@ "deprecated": false, "x-appwrite": { "method": "listTables", - "group": null, + "group": "tables", "weight": 382, "cookies": false, "type": "", @@ -23174,7 +23174,7 @@ "deprecated": false, "x-appwrite": { "method": "createTable", - "group": null, + "group": "tables", "weight": 378, "cookies": false, "type": "", @@ -23283,7 +23283,7 @@ "deprecated": false, "x-appwrite": { "method": "getTable", - "group": null, + "group": "tables", "weight": 379, "cookies": false, "type": "", @@ -23354,7 +23354,7 @@ "deprecated": false, "x-appwrite": { "method": "updateTable", - "group": null, + "group": "tables", "weight": 380, "cookies": false, "type": "", @@ -23459,7 +23459,7 @@ "deprecated": false, "x-appwrite": { "method": "deleteTable", - "group": null, + "group": "tables", "weight": 381, "cookies": false, "type": "", 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 a3c387aba9..995cca5a45 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php @@ -41,7 +41,7 @@ class Create extends CollectionCreate ->label('audits.resource', 'database/{request.databaseId}/table/{response.$id}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: null, + group: "tables", name: self::getName(), description: '/docs/references/tablesdb/create-table.md', auth: [AuthType::KEY], 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 8312b53f40..2a8f5006ea 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php @@ -37,7 +37,7 @@ class Delete extends CollectionDelete ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: null, + group: "tables", name: self::getName(), description: '/docs/references/tablesdb/delete-table.md', auth: [AuthType::KEY], diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php index ce29a24097..72a625557c 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php @@ -34,7 +34,7 @@ class Get extends CollectionGet ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: null, + group: "tables", name: self::getName(), description: '/docs/references/tablesdb/get-table.md', auth: [AuthType::KEY], 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 8bc44bd212..d4ebdcaf91 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -40,7 +40,7 @@ class Update extends CollectionUpdate ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: null, + group: "tables", name: self::getName(), description: '/docs/references/tablesdb/update-table.md', auth: [AuthType::KEY], diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php index 9a91a0ef36..d8e340265b 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php @@ -36,7 +36,7 @@ class XList extends CollectionXList ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: null, + group: "tables", name: self::getName(), description: '/docs/references/tablesdb/list-tables.md', auth: [AuthType::KEY], From c26e28d5a6fc721c0e70f3ea5f0901f5b50f42ef Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 19:04:37 +0530 Subject: [PATCH 14/24] fix: namespace naming from tables-db to tablesdb in specs --- app/config/specs/open-api3-1.8.x-client.json | 4 ++-- app/config/specs/open-api3-1.8.x-console.json | 12 ++++++------ app/config/specs/open-api3-1.8.x-server.json | 8 ++++---- app/config/specs/open-api3-latest-client.json | 4 ++-- app/config/specs/open-api3-latest-console.json | 12 ++++++------ app/config/specs/open-api3-latest-server.json | 8 ++++---- app/config/specs/swagger2-1.8.x-client.json | 4 ++-- app/config/specs/swagger2-1.8.x-console.json | 12 ++++++------ app/config/specs/swagger2-1.8.x-server.json | 8 ++++---- app/config/specs/swagger2-latest-client.json | 4 ++-- app/config/specs/swagger2-latest-console.json | 12 ++++++------ app/config/specs/swagger2-latest-server.json | 8 ++++---- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 2 +- src/Appwrite/SDK/Specification/Format/Swagger2.php | 2 +- 14 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-client.json b/app/config/specs/open-api3-1.8.x-client.json index 807a39a79d..e3fd3bd04a 100644 --- a/app/config/specs/open-api3-1.8.x-client.json +++ b/app/config/specs/open-api3-1.8.x-client.json @@ -7625,7 +7625,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" } ], "auth": { @@ -7867,7 +7867,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 9b17bb4307..01fcb0dbb9 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -32189,7 +32189,7 @@ } ], "description": "List usage metrics and statistics for all databases in the project. You can view the total number of databases, tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/list-usage.md" + "demo": "tablesdb\/list-usage.md" } ], "auth": { @@ -36082,7 +36082,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -36108,7 +36108,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -36247,7 +36247,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -36662,7 +36662,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { @@ -37410,7 +37410,7 @@ } ], "description": "Get usage metrics and statistics for a database. You can view the total number of tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/get-usage.md" + "demo": "tablesdb\/get-usage.md" } ], "auth": { diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 1bbc0c7554..6b1b75a46e 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -26438,7 +26438,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -26465,7 +26465,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -26607,7 +26607,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -27028,7 +27028,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 807a39a79d..e3fd3bd04a 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -7625,7 +7625,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" } ], "auth": { @@ -7867,7 +7867,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 9b17bb4307..01fcb0dbb9 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -32189,7 +32189,7 @@ } ], "description": "List usage metrics and statistics for all databases in the project. You can view the total number of databases, tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/list-usage.md" + "demo": "tablesdb\/list-usage.md" } ], "auth": { @@ -36082,7 +36082,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -36108,7 +36108,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -36247,7 +36247,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -36662,7 +36662,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { @@ -37410,7 +37410,7 @@ } ], "description": "Get usage metrics and statistics for a database. You can view the total number of tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/get-usage.md" + "demo": "tablesdb\/get-usage.md" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 1bbc0c7554..6b1b75a46e 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -26438,7 +26438,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -26465,7 +26465,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -26607,7 +26607,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -27028,7 +27028,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/swagger2-1.8.x-client.json b/app/config/specs/swagger2-1.8.x-client.json index 650a74c817..3a6152b6ad 100644 --- a/app/config/specs/swagger2-1.8.x-client.json +++ b/app/config/specs/swagger2-1.8.x-client.json @@ -7702,7 +7702,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" } ], "auth": { @@ -7935,7 +7935,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index ba78f719a8..7d81a5d8e5 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -32373,7 +32373,7 @@ } ], "description": "List usage metrics and statistics for all databases in the project. You can view the total number of databases, tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/list-usage.md" + "demo": "tablesdb\/list-usage.md" } ], "auth": { @@ -36207,7 +36207,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -36233,7 +36233,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -36372,7 +36372,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -36770,7 +36770,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { @@ -37477,7 +37477,7 @@ } ], "description": "Get usage metrics and statistics for a database. You can view the total number of tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/get-usage.md" + "demo": "tablesdb\/get-usage.md" } ], "auth": { diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 9d3673333d..b4423d9433 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -26623,7 +26623,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -26650,7 +26650,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -26792,7 +26792,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -27196,7 +27196,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 650a74c817..3a6152b6ad 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -7702,7 +7702,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" } ], "auth": { @@ -7935,7 +7935,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index ba78f719a8..7d81a5d8e5 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -32373,7 +32373,7 @@ } ], "description": "List usage metrics and statistics for all databases in the project. You can view the total number of databases, tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/list-usage.md" + "demo": "tablesdb\/list-usage.md" } ], "auth": { @@ -36207,7 +36207,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -36233,7 +36233,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -36372,7 +36372,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -36770,7 +36770,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { @@ -37477,7 +37477,7 @@ } ], "description": "Get usage metrics and statistics for a database. You can view the total number of tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.", - "demo": "tables-db\/get-usage.md" + "demo": "tablesdb\/get-usage.md" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 9d3673333d..b4423d9433 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -26623,7 +26623,7 @@ } ], "description": "Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-row.md" + "demo": "tablesdb\/create-row.md" }, { "name": "createRows", @@ -26650,7 +26650,7 @@ } ], "description": "Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/create-rows.md" + "demo": "tablesdb\/create-rows.md" } ], "auth": { @@ -26792,7 +26792,7 @@ } ], "description": "Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.\n", - "demo": "tables-db\/upsert-rows.md" + "demo": "tablesdb\/upsert-rows.md" } ], "auth": { @@ -27196,7 +27196,7 @@ } ], "description": "Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/tablesdb#tablesDBCreateTable) API or directly from your database console.", - "demo": "tables-db\/upsert-row.md" + "demo": "tablesdb\/upsert-row.md" } ], "auth": { diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index b3aaefd33f..4a492e4c00 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -221,7 +221,7 @@ class OpenAPI3 extends Format 'required' => [], 'responses' => [], 'description' => ($desc) ? \file_get_contents($desc) : '', - 'demo' => Template::fromCamelCaseToDash($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', + 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', ]; // add deprecation only if method has it! diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 2a50f6fd9c..313d46be8f 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -230,7 +230,7 @@ class Swagger2 extends Format 'required' => [], 'responses' => [], 'description' => ($desc) ? \file_get_contents($desc) : '', - 'demo' => Template::fromCamelCaseToDash($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', + 'demo' => \strtolower($namespace) . '/' . Template::fromCamelCaseToDash($methodObj->getMethodName()) . '.md', ]; // add deprecation only if method has it! From 6dc33ed27a16490f7782a749d1b2c2fb94f923ba Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Wed, 27 Aug 2025 19:29:34 +0530 Subject: [PATCH 15/24] use single quotes --- .../Platform/Modules/Databases/Http/TablesDB/Tables/Create.php | 2 +- .../Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php | 2 +- .../Platform/Modules/Databases/Http/TablesDB/Tables/Get.php | 2 +- .../Platform/Modules/Databases/Http/TablesDB/Tables/Update.php | 2 +- .../Platform/Modules/Databases/Http/TablesDB/Tables/XList.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) 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 995cca5a45..3965e12a74 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Create.php @@ -41,7 +41,7 @@ class Create extends CollectionCreate ->label('audits.resource', 'database/{request.databaseId}/table/{response.$id}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: "tables", + group: 'tables', name: self::getName(), description: '/docs/references/tablesdb/create-table.md', auth: [AuthType::KEY], 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 2a8f5006ea..9bfdf42cef 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Delete.php @@ -37,7 +37,7 @@ class Delete extends CollectionDelete ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: "tables", + group: 'tables', name: self::getName(), description: '/docs/references/tablesdb/delete-table.md', auth: [AuthType::KEY], diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php index 72a625557c..a7d33478f7 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Get.php @@ -34,7 +34,7 @@ class Get extends CollectionGet ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: "tables", + group: 'tables', name: self::getName(), description: '/docs/references/tablesdb/get-table.md', auth: [AuthType::KEY], 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 d4ebdcaf91..0fcdf319d2 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/Update.php @@ -40,7 +40,7 @@ class Update extends CollectionUpdate ->label('audits.resource', 'database/{request.databaseId}/table/{request.tableId}') ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: "tables", + group: 'tables', name: self::getName(), description: '/docs/references/tablesdb/update-table.md', auth: [AuthType::KEY], diff --git a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php index d8e340265b..d9a92e41b1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/TablesDB/Tables/XList.php @@ -36,7 +36,7 @@ class XList extends CollectionXList ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('sdk', new Method( namespace: $this->getSdkNamespace(), - group: "tables", + group: 'tables', name: self::getName(), description: '/docs/references/tablesdb/list-tables.md', auth: [AuthType::KEY], From ca6f9476427fb7a12ab95b6c95e7a222772689f7 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 28 Aug 2025 10:04:28 +0530 Subject: [PATCH 16/24] chore: update description for upsert methods --- app/config/specs/open-api3-1.8.x-console.json | 4 ++-- app/config/specs/open-api3-1.8.x-server.json | 4 ++-- app/config/specs/open-api3-latest-console.json | 4 ++-- app/config/specs/open-api3-latest-server.json | 4 ++-- app/config/specs/swagger2-1.8.x-console.json | 4 ++-- app/config/specs/swagger2-1.8.x-server.json | 4 ++-- app/config/specs/swagger2-latest-console.json | 4 ++-- app/config/specs/swagger2-latest-server.json | 4 ++-- .../Http/Databases/Collections/Documents/Bulk/Upsert.php | 2 +- .../Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 3812613df5..539463fecf 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -8940,7 +8940,7 @@ } }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -36183,7 +36183,7 @@ } }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index 2028156c4c..d3a60a4ee4 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -8416,7 +8416,7 @@ } }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -26542,7 +26542,7 @@ } }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 3812613df5..539463fecf 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -8940,7 +8940,7 @@ } }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -36183,7 +36183,7 @@ } }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 2028156c4c..d3a60a4ee4 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -8416,7 +8416,7 @@ } }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -26542,7 +26542,7 @@ } }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index a6fe530d16..c0f9edde62 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -9058,7 +9058,7 @@ ] }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -36306,7 +36306,7 @@ ] }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 5b8c700365..4de1241c76 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -8524,7 +8524,7 @@ ] }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -26725,7 +26725,7 @@ ] }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index a6fe530d16..c0f9edde62 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -9058,7 +9058,7 @@ ] }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -36306,7 +36306,7 @@ ] }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 5b8c700365..4de1241c76 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -8524,7 +8524,7 @@ ] }, "put": { - "summary": "Create or update documents", + "summary": "Upsert Documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -26725,7 +26725,7 @@ ] }, "put": { - "summary": "Create or update rows", + "summary": "Upsert Rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" 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 d7d6e1abbe..c72ff81735 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 @@ -39,7 +39,7 @@ class Upsert extends Action $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/documents') - ->desc('Create or update documents') + ->desc('Upsert Documents') ->groups(['api', 'database']) ->label('scope', 'documents.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) 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 7b0d53da74..1876d8231d 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 @@ -30,7 +30,7 @@ class Upsert extends DocumentsUpsert $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/rows') - ->desc('Create or update rows') + ->desc('Upsert Rows') ->groups(['api', 'database']) ->label('scope', ['rows.write', 'documents.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) From 6e519850375e1f92e9823bfa1deea33b60be3d1e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 28 Aug 2025 12:31:14 +0530 Subject: [PATCH 17/24] casing --- app/config/specs/open-api3-1.8.x-console.json | 4 ++-- app/config/specs/open-api3-1.8.x-server.json | 4 ++-- app/config/specs/open-api3-latest-console.json | 4 ++-- app/config/specs/open-api3-latest-server.json | 4 ++-- app/config/specs/swagger2-1.8.x-console.json | 4 ++-- app/config/specs/swagger2-1.8.x-server.json | 4 ++-- app/config/specs/swagger2-latest-console.json | 4 ++-- app/config/specs/swagger2-latest-server.json | 4 ++-- .../Http/Databases/Collections/Documents/Bulk/Upsert.php | 2 +- .../Databases/Http/TablesDB/Tables/Rows/Bulk/Upsert.php | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/config/specs/open-api3-1.8.x-console.json b/app/config/specs/open-api3-1.8.x-console.json index 539463fecf..29c45692ec 100644 --- a/app/config/specs/open-api3-1.8.x-console.json +++ b/app/config/specs/open-api3-1.8.x-console.json @@ -8940,7 +8940,7 @@ } }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -36183,7 +36183,7 @@ } }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-1.8.x-server.json b/app/config/specs/open-api3-1.8.x-server.json index d3a60a4ee4..60c07da12a 100644 --- a/app/config/specs/open-api3-1.8.x-server.json +++ b/app/config/specs/open-api3-1.8.x-server.json @@ -8416,7 +8416,7 @@ } }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -26542,7 +26542,7 @@ } }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 539463fecf..29c45692ec 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -8940,7 +8940,7 @@ } }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -36183,7 +36183,7 @@ } }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index d3a60a4ee4..60c07da12a 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -8416,7 +8416,7 @@ } }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "tags": [ "databases" @@ -26542,7 +26542,7 @@ } }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "tags": [ "tablesDB" diff --git a/app/config/specs/swagger2-1.8.x-console.json b/app/config/specs/swagger2-1.8.x-console.json index c0f9edde62..5e121e8840 100644 --- a/app/config/specs/swagger2-1.8.x-console.json +++ b/app/config/specs/swagger2-1.8.x-console.json @@ -9058,7 +9058,7 @@ ] }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -36306,7 +36306,7 @@ ] }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-1.8.x-server.json b/app/config/specs/swagger2-1.8.x-server.json index 4de1241c76..e4ffbbe973 100644 --- a/app/config/specs/swagger2-1.8.x-server.json +++ b/app/config/specs/swagger2-1.8.x-server.json @@ -8524,7 +8524,7 @@ ] }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -26725,7 +26725,7 @@ ] }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index c0f9edde62..5e121e8840 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -9058,7 +9058,7 @@ ] }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -36306,7 +36306,7 @@ ] }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 4de1241c76..e4ffbbe973 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -8524,7 +8524,7 @@ ] }, "put": { - "summary": "Upsert Documents", + "summary": "Upsert documents", "operationId": "databasesUpsertDocuments", "consumes": [ "application\/json" @@ -26725,7 +26725,7 @@ ] }, "put": { - "summary": "Upsert Rows", + "summary": "Upsert rows", "operationId": "tablesDBUpsertRows", "consumes": [ "application\/json" 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 c72ff81735..a6f27637e3 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 @@ -39,7 +39,7 @@ class Upsert extends Action $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/databases/:databaseId/collections/:collectionId/documents') - ->desc('Upsert Documents') + ->desc('Upsert documents') ->groups(['api', 'database']) ->label('scope', 'documents.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) 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 1876d8231d..c4a7c6e677 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 @@ -30,7 +30,7 @@ class Upsert extends DocumentsUpsert $this ->setHttpMethod(self::HTTP_REQUEST_METHOD_PUT) ->setHttpPath('/v1/tablesdb/:databaseId/tables/:tableId/rows') - ->desc('Upsert Rows') + ->desc('Upsert rows') ->groups(['api', 'database']) ->label('scope', ['rows.write', 'documents.write']) ->label('resourceType', RESOURCE_TYPE_DATABASES) From 0737c78cb5a33156686131af5faca6ca9763e4b8 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:06:18 +0530 Subject: [PATCH 18/24] added processing of migration resource stats --- src/Appwrite/Platform/Workers/Migrations.php | 103 ++++++++++++++++++- 1 file changed, 99 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 39adb37374..b90dcd635d 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -4,6 +4,7 @@ namespace Appwrite\Platform\Workers; use Ahc\Jwt\JWT; use Appwrite\Event\Realtime; +use Appwrite\Event\StatsUsage; use Exception; use Utopia\CLI\Console; use Utopia\Config\Config; @@ -13,9 +14,14 @@ use Utopia\Database\Exception\Authorization; use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Structure; +use Utopia\Database\Validator\Authorization as AuthorizationValidator; use Utopia\Migration\Destination; use Utopia\Migration\Destinations\Appwrite as DestinationAppwrite; use Utopia\Migration\Exception as MigrationException; +use Utopia\Migration\Resource; +use Utopia\Migration\Resources\Database\Database as ResourceDatabase; +use Utopia\Migration\Resources\Database\Row as ResourceRow; +use Utopia\Migration\Resources\Database\Table as ResourceTable; use Utopia\Migration\Source; use Utopia\Migration\Sources\Appwrite as SourceAppwrite; use Utopia\Migration\Sources\CSV; @@ -45,6 +51,7 @@ class Migrations extends Action */ protected array $sourceReport = []; + private string $source; /** * @var callable */ @@ -69,13 +76,14 @@ class Migrations extends Action ->inject('logError') ->inject('queueForRealtime') ->inject('deviceForImports') + ->inject('queueForStatsUsage') // Added ->callback($this->action(...)); } /** * @throws Exception */ - public function action(Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError, Realtime $queueForRealtime, Device $deviceForImports): void + public function action(Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError, Realtime $queueForRealtime, Device $deviceForImports, StatsUsage $queueForStatsUsage): void { $payload = $message->getPayload() ?? []; $this->deviceForImports = $deviceForImports; @@ -103,7 +111,7 @@ class Migrations extends Action return; } - $this->processMigration($migration, $queueForRealtime); + $this->processMigration($migration, $queueForRealtime, $queueForStatsUsage); // Updated } /** @@ -267,7 +275,7 @@ class Migrations extends Action * @throws \Utopia\Database\Exception * @throws Exception */ - protected function processMigration(Document $migration, Realtime $queueForRealtime): void + protected function processMigration(Document $migration, Realtime $queueForRealtime, StatsUsage $queueForStatsUsage): void { $project = $this->project; $projectDocument = $this->dbForPlatform->getDocument('projects', $project->getId()); @@ -301,6 +309,7 @@ class Migrations extends Action $destination ); + $aggregatedResources = []; /** Start Transfer */ if (empty($source->getErrors())) { $migration->setAttribute('stage', 'migrating'); @@ -308,9 +317,13 @@ class Migrations extends Action $transfer->run( $migration->getAttribute('resources'), - function () use ($migration, $transfer, $projectDocument, $queueForRealtime) { + function ($resources) use ($migration, $transfer, $projectDocument, $queueForRealtime, &$aggregatedResources) { $migration->setAttribute('resourceData', json_encode($transfer->getCache())); $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); + + if (!empty($resources)) { + $aggregatedResources[] = $resources; + } $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); }, $migration->getAttribute('resourceId'), @@ -412,9 +425,91 @@ class Migrations extends Action } if ($migration->getAttribute('status', '') === 'completed') { + foreach ($aggregatedResources as $resource) { + $this->processMigrationResourceStats( + $resource, + $queueForStatsUsage, + $projectDocument, + $migration->getAttribute('source'), + $migration->getAttribute('resourceId') + ); + } $destination?->success(); $source?->success(); } } } + + private function processMigrationResourceStats(array $resources, StatsUsage $queueForStatsUsage, Document $projectDocument, string $source, ?string $resourceId) + { + /** + * @var Resource $resource + */ + var_dump($resources); + $resource = $resources[0]; + + $databaseInternalId = null; + $tableInternalId = null; + if ($source === CSV::getName() && !empty($resourceId)) { + [$databaseId, $tableId] = explode(':', $resourceId); + $database = AuthorizationValidator::skip(fn () => $this->dbForProject->getDocument('databases', $databaseId)); + $table = AuthorizationValidator::skip(fn () => $this->dbForProject->getDocument('database_' . $database->getSequence(), $tableId)); + $databaseInternalId = (int) $database->getSequence(); + $tableInternalId = (int) $table->getSequence(); + } + + $count = count($resources); + + switch ($resource->getName()) { + case ResourceDatabase::getName(): + $queueForStatsUsage->addMetric(METRIC_DATABASES, $count); + break; + + case ResourceTable::getName(): + /** @var ResourceTable $resource */ + $dbSeq = ($source === CSV::getName() && !empty($databaseInternalId)) + ? (int) $databaseInternalId + : (int) $resource->getDatabase()->getSequence(); + + $queueForStatsUsage + ->addMetric(METRIC_COLLECTIONS, $count) + ->addMetric( + str_replace('{databaseInternalId}', $dbSeq, METRIC_DATABASE_ID_COLLECTIONS), + $count + ); + break; + + case ResourceRow::getName(): + /** @var ResourceRow $resource */ + + $table = $resource->getTable(); + $dbSeq = ($source === CSV::getName() && !empty($databaseInternalId)) + ? (int) $databaseInternalId + : (int) $table->getDatabase()->getSequence(); + $colSeq = ($source === CSV::getName() && !empty($tableInternalId)) + ? (int) $tableInternalId + : (int) $table->getSequence(); + + $queueForStatsUsage + ->addMetric( + str_replace( + ['{databaseInternalId}','{collectionInternalId}'], + [$dbSeq, $colSeq], + METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS + ), + $count + ) + ->addMetric( + str_replace('{databaseInternalId}', $dbSeq, METRIC_DATABASE_ID_DOCUMENTS), + $count + ); + break; + + default: + break; + } + + $queueForStatsUsage->setProject($projectDocument)->trigger(); + $queueForStatsUsage->reset(); + } } From a809832f05bb992f7b5afc8887b4b9604c0e2f0b Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:10:00 +0530 Subject: [PATCH 19/24] lint --- src/Appwrite/Platform/Workers/Migrations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index b90dcd635d..2e23621850 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -76,7 +76,7 @@ class Migrations extends Action ->inject('logError') ->inject('queueForRealtime') ->inject('deviceForImports') - ->inject('queueForStatsUsage') // Added + ->inject('queueForStatsUsage') ->callback($this->action(...)); } @@ -111,7 +111,7 @@ class Migrations extends Action return; } - $this->processMigration($migration, $queueForRealtime, $queueForStatsUsage); // Updated + $this->processMigration($migration, $queueForRealtime, $queueForStatsUsage); } /** From 743bcceb5668b27ab3aba9e207b0de2a3a3181db Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:13:24 +0530 Subject: [PATCH 20/24] updated migration version --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 077f5204d1..1a776c089e 100644 --- a/composer.lock +++ b/composer.lock @@ -3557,16 +3557,16 @@ }, { "name": "utopia-php/database", - "version": "1.2.1", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "99beaf1dd6dc3561c8332f9893325777553644a4" + "reference": "8a536fead840d9da6ee819fe6b80e0f047997f69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/99beaf1dd6dc3561c8332f9893325777553644a4", - "reference": "99beaf1dd6dc3561c8332f9893325777553644a4", + "url": "https://api.github.com/repos/utopia-php/database/zipball/8a536fead840d9da6ee819fe6b80e0f047997f69", + "reference": "8a536fead840d9da6ee819fe6b80e0f047997f69", "shasum": "" }, "require": { @@ -3607,9 +3607,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/1.2.1" + "source": "https://github.com/utopia-php/database/tree/1.2.3" }, - "time": "2025-08-26T16:05:26+00:00" + "time": "2025-08-27T11:47:04+00:00" }, { "name": "utopia-php/detector", @@ -4109,16 +4109,16 @@ }, { "name": "utopia-php/migration", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "0e4499d9dd2c90c2be188cc5fb7a32d9a892b569" + "reference": "38171023efd3abe650d2abc5ac65f5df52311da6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/0e4499d9dd2c90c2be188cc5fb7a32d9a892b569", - "reference": "0e4499d9dd2c90c2be188cc5fb7a32d9a892b569", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/38171023efd3abe650d2abc5ac65f5df52311da6", + "reference": "38171023efd3abe650d2abc5ac65f5df52311da6", "shasum": "" }, "require": { @@ -4159,9 +4159,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.0.0" + "source": "https://github.com/utopia-php/migration/tree/1.0.1" }, - "time": "2025-08-13T09:15:53+00:00" + "time": "2025-08-28T13:41:25+00:00" }, { "name": "utopia-php/orchestration", From f067d1fadf3c805af3b03e8b35a0153899ef8b46 Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:14:14 +0530 Subject: [PATCH 21/24] updated reset of the stats usage worker to reset metrics --- src/Appwrite/Event/StatsUsage.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Appwrite/Event/StatsUsage.php b/src/Appwrite/Event/StatsUsage.php index f6b1d695f4..f9e03c7c3d 100644 --- a/src/Appwrite/Event/StatsUsage.php +++ b/src/Appwrite/Event/StatsUsage.php @@ -85,4 +85,11 @@ class StatsUsage extends Event }), ]; } + + public function reset(): Event + { + $this->metrics = []; + parent::reset(); + return $this; + } } From e2575e73604fcc74ae08d4857f953793984541bb Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:21:11 +0530 Subject: [PATCH 22/24] linting --- src/Appwrite/Platform/Workers/Migrations.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 2e23621850..f5def0fff6 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -445,7 +445,6 @@ class Migrations extends Action /** * @var Resource $resource */ - var_dump($resources); $resource = $resources[0]; $databaseInternalId = null; From bef0aff7c91dba50492ec762f4cebc106bfb51ea Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Thu, 28 Aug 2025 19:59:48 +0530 Subject: [PATCH 23/24] optimised the memory usage by resource aggregation --- src/Appwrite/Platform/Workers/Migrations.php | 66 +++++++++++--------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index f5def0fff6..eb0ece0197 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -322,7 +322,34 @@ class Migrations extends Action $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); if (!empty($resources)) { - $aggregatedResources[] = $resources; + /** + * @var Resource $resource + */ + $resource = $resources[0]; + $count = count($resources); + $databaseId = null; + $tableId = null; + switch ($resource->getName()) { + case ResourceTable::getName(): + /** @var ResourceTable $resource */ + $databaseId = $resource->getDatabase()->getSequence(); + break; + case ResourceRow::getName(): + /** @var ResourceRow $resource */ + $table = $resource->getTable(); + $databaseId = $table->getDatabase()->getSequence(); + $tableId = $table->getSequence(); + break; + default: + break; + } + $aggregatedResources[] = [ + "name" => $resource->getName(), + "count" => $count, + "databaseId" => $databaseId, + "tableId" => $tableId + ]; + } $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime); }, @@ -442,14 +469,12 @@ class Migrations extends Action private function processMigrationResourceStats(array $resources, StatsUsage $queueForStatsUsage, Document $projectDocument, string $source, ?string $resourceId) { - /** - * @var Resource $resource - */ - $resource = $resources[0]; + $resourceName = $resources['name']; + $count = $resources['count']; + $databaseInternalId = $resources['databaseId']; + $tableInternalId = $resources['tableId']; - $databaseInternalId = null; - $tableInternalId = null; - if ($source === CSV::getName() && !empty($resourceId)) { + if ($source === CSV::getName()) { [$databaseId, $tableId] = explode(':', $resourceId); $database = AuthorizationValidator::skip(fn () => $this->dbForProject->getDocument('databases', $databaseId)); $table = AuthorizationValidator::skip(fn () => $this->dbForProject->getDocument('database_' . $database->getSequence(), $tableId)); @@ -457,49 +482,32 @@ class Migrations extends Action $tableInternalId = (int) $table->getSequence(); } - $count = count($resources); - - switch ($resource->getName()) { + switch ($resourceName) { case ResourceDatabase::getName(): $queueForStatsUsage->addMetric(METRIC_DATABASES, $count); break; case ResourceTable::getName(): - /** @var ResourceTable $resource */ - $dbSeq = ($source === CSV::getName() && !empty($databaseInternalId)) - ? (int) $databaseInternalId - : (int) $resource->getDatabase()->getSequence(); - $queueForStatsUsage ->addMetric(METRIC_COLLECTIONS, $count) ->addMetric( - str_replace('{databaseInternalId}', $dbSeq, METRIC_DATABASE_ID_COLLECTIONS), + str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_COLLECTIONS), $count ); break; case ResourceRow::getName(): - /** @var ResourceRow $resource */ - - $table = $resource->getTable(); - $dbSeq = ($source === CSV::getName() && !empty($databaseInternalId)) - ? (int) $databaseInternalId - : (int) $table->getDatabase()->getSequence(); - $colSeq = ($source === CSV::getName() && !empty($tableInternalId)) - ? (int) $tableInternalId - : (int) $table->getSequence(); - $queueForStatsUsage ->addMetric( str_replace( ['{databaseInternalId}','{collectionInternalId}'], - [$dbSeq, $colSeq], + [$databaseInternalId, $tableInternalId], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS ), $count ) ->addMetric( - str_replace('{databaseInternalId}', $dbSeq, METRIC_DATABASE_ID_DOCUMENTS), + str_replace('{databaseInternalId}', $databaseInternalId, METRIC_DATABASE_ID_DOCUMENTS), $count ); break; From f43cbaf1a8d0e08e7b261706a63de4a251bacf9d Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 29 Aug 2025 02:48:31 +1200 Subject: [PATCH 24/24] Update src/Appwrite/Platform/Workers/Migrations.php --- src/Appwrite/Platform/Workers/Migrations.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index eb0ece0197..ff25e799c1 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -344,10 +344,10 @@ class Migrations extends Action break; } $aggregatedResources[] = [ - "name" => $resource->getName(), - "count" => $count, - "databaseId" => $databaseId, - "tableId" => $tableId + 'name' => $resource->getName(), + 'count' => $count, + 'databaseId' => $databaseId, + 'tableId' => $tableId ]; }