diff --git a/app/config/errors.php b/app/config/errors.php index dc6dcd5daf..fc79599b12 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -699,6 +699,11 @@ return [ 'description' => 'The relationship value is invalid.', 'code' => 400, ], + Exception::ATTRIBUTE_INVALID_RESIZE => [ + 'name' => Exception::ATTRIBUTE_INVALID_RESIZE, + 'description' => "Existing data is too large for new size, truncate your existing data then try again.", + 'code' => 400, + ], /** Indexes */ Exception::INDEX_NOT_FOUND => [ diff --git a/app/config/platforms.php b/app/config/platforms.php index d914712208..40cea19fd3 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -203,7 +203,7 @@ return [ [ 'key' => 'web', 'name' => 'Console', - 'version' => '1.0.1', + 'version' => '1.1.0', 'url' => 'https://github.com/appwrite/sdk-for-console', 'package' => '', 'enabled' => true, @@ -249,7 +249,7 @@ return [ [ 'key' => 'nodejs', 'name' => 'Node.js', - 'version' => '14.0.0', + 'version' => '14.1.0', 'url' => 'https://github.com/appwrite/sdk-for-node', 'package' => 'https://www.npmjs.com/package/node-appwrite', 'enabled' => true, @@ -267,7 +267,7 @@ return [ [ 'key' => 'deno', 'name' => 'Deno', - 'version' => '12.0.0', + 'version' => '12.1.0', 'url' => 'https://github.com/appwrite/sdk-for-deno', 'package' => 'https://deno.land/x/appwrite', 'enabled' => true, @@ -303,7 +303,7 @@ return [ [ 'key' => 'python', 'name' => 'Python', - 'version' => '6.0.0', + 'version' => '6.1.0', 'url' => 'https://github.com/appwrite/sdk-for-python', 'package' => 'https://pypi.org/project/appwrite/', 'enabled' => true, @@ -321,7 +321,7 @@ return [ [ 'key' => 'ruby', 'name' => 'Ruby', - 'version' => '12.0.0', + 'version' => '12.1.0', 'url' => 'https://github.com/appwrite/sdk-for-ruby', 'package' => 'https://rubygems.org/gems/appwrite', 'enabled' => true, @@ -339,7 +339,7 @@ return [ [ 'key' => 'go', 'name' => 'Go', - 'version' => '0.1.0', + 'version' => '0.2.0', 'url' => 'https://github.com/appwrite/sdk-for-go', 'package' => 'https://github.com/appwrite/sdk-for-go', 'enabled' => true, @@ -357,7 +357,7 @@ return [ [ 'key' => 'dotnet', 'name' => '.NET', - 'version' => '0.9.0', + 'version' => '0.10.0', 'url' => 'https://github.com/appwrite/sdk-for-dotnet', 'package' => 'https://www.nuget.org/packages/Appwrite', 'enabled' => true, @@ -375,7 +375,7 @@ return [ [ 'key' => 'dart', 'name' => 'Dart', - 'version' => '12.0.0', + 'version' => '12.1.0', 'url' => 'https://github.com/appwrite/sdk-for-dart', 'package' => 'https://pub.dev/packages/dart_appwrite', 'enabled' => true, @@ -393,7 +393,7 @@ return [ [ 'key' => 'kotlin', 'name' => 'Kotlin', - 'version' => '6.0.0', + 'version' => '6.1.0', 'url' => 'https://github.com/appwrite/sdk-for-kotlin', 'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin', 'enabled' => true, @@ -415,7 +415,7 @@ return [ [ 'key' => 'swift', 'name' => 'Swift', - 'version' => '6.0.0', + 'version' => '6.1.0', 'url' => 'https://github.com/appwrite/sdk-for-swift', 'package' => 'https://github.com/appwrite/sdk-for-swift', 'enabled' => true, diff --git a/app/config/specs/open-api3-1.6.x-client.json b/app/config/specs/open-api3-1.6.x-client.json index 85c269f902..4beb666a1c 100644 --- a/app/config/specs/open-api3-1.6.x-client.json +++ b/app/config/specs/open-api3-1.6.x-client.json @@ -9897,4 +9897,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/open-api3-1.6.x-console.json b/app/config/specs/open-api3-1.6.x-console.json index b515120051..215d484241 100644 --- a/app/config/specs/open-api3-1.6.x-console.json +++ b/app/config/specs/open-api3-1.6.x-console.json @@ -38373,4 +38373,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/open-api3-1.6.x-server.json b/app/config/specs/open-api3-1.6.x-server.json index dc18913a4c..34586080e7 100644 --- a/app/config/specs/open-api3-1.6.x-server.json +++ b/app/config/specs/open-api3-1.6.x-server.json @@ -26939,4 +26939,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 85c269f902..4beb666a1c 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -9897,4 +9897,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index b515120051..215d484241 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -38373,4 +38373,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index dc18913a4c..34586080e7 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -26939,4 +26939,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-1.6.x-client.json b/app/config/specs/swagger2-1.6.x-client.json index 2ef3a7581f..259add8704 100644 --- a/app/config/specs/swagger2-1.6.x-client.json +++ b/app/config/specs/swagger2-1.6.x-client.json @@ -10052,4 +10052,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-1.6.x-console.json b/app/config/specs/swagger2-1.6.x-console.json index ce9e2bf5d5..0e925e7630 100644 --- a/app/config/specs/swagger2-1.6.x-console.json +++ b/app/config/specs/swagger2-1.6.x-console.json @@ -38886,4 +38886,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-1.6.x-server.json b/app/config/specs/swagger2-1.6.x-server.json index 58ee3404a1..da55c28bfa 100644 --- a/app/config/specs/swagger2-1.6.x-server.json +++ b/app/config/specs/swagger2-1.6.x-server.json @@ -27378,4 +27378,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 2ef3a7581f..259add8704 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -10052,4 +10052,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index ce9e2bf5d5..0e925e7630 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -38886,4 +38886,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 58ee3404a1..da55c28bfa 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -27378,4 +27378,4 @@ "description": "Full API docs, specs and tutorials", "url": "https:\/\/appwrite.io\/docs" } -} \ No newline at end of file +} diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 17f3af4364..737bd3e09d 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -4018,7 +4018,7 @@ App::post('/v1/account/mfa/challenge') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_MFA_CHALLENGE) ->label('abuse-limit', 10) - ->label('abuse-key', 'url:{url},token:{param-token}') + ->label('abuse-key', 'url:{url},userId:{userId}') ->param('factor', '', new WhiteList([Type::EMAIL, Type::PHONE, Type::TOTP, Type::RECOVERY_CODE]), 'Factor used for verification. Must be one of following: `' . Type::EMAIL . '`, `' . Type::PHONE . '`, `' . Type::TOTP . '`, `' . Type::RECOVERY_CODE . '`.') ->inject('response') ->inject('dbForProject') @@ -4205,7 +4205,7 @@ App::put('/v1/account/mfa/challenge') ->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT) ->label('sdk.response.model', Response::MODEL_SESSION) ->label('abuse-limit', 10) - ->label('abuse-key', 'userId:{param-userId}') + ->label('abuse-key', 'url:{url},challengeId:{param-challengeId}') ->param('challengeId', '', new Text(256), 'ID of the challenge.') ->param('otp', '', new Text(256), 'Valid verification token.') ->inject('project') diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 54fc1cb08f..a9bb58df4b 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -20,12 +20,15 @@ use Utopia\Audit\Audit; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception as DatabaseException; use Utopia\Database\Exception\Authorization as AuthorizationException; use Utopia\Database\Exception\Conflict as ConflictException; use Utopia\Database\Exception\Duplicate as DuplicateException; use Utopia\Database\Exception\Limit as LimitException; +use Utopia\Database\Exception\Query as QueryException; use Utopia\Database\Exception\Restricted as RestrictedException; use Utopia\Database\Exception\Structure as StructureException; +use Utopia\Database\Exception\Truncate as TruncateException; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; @@ -228,13 +231,15 @@ function updateAttribute( Database $dbForProject, Event $queueForEvents, string $type, + int $size = null, string $filter = null, string|bool|int|float $default = null, bool $required = null, int|float $min = null, int|float $max = null, array $elements = null, - array $options = [] + array $options = [], + string $newKey = null, ): Document { $db = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId)); @@ -280,6 +285,10 @@ function updateAttribute( ->setAttribute('default', $default) ->setAttribute('required', $required); + if (!empty($size)) { + $attribute->setAttribute('size', $size); + } + $formatOptions = $attribute->getAttribute('formatOptions'); switch ($attribute->getAttribute('format')) { @@ -345,6 +354,7 @@ function updateAttribute( $dbForProject->updateRelationship( collection: $collectionId, id: $key, + newKey: $newKey, onDelete: $primaryDocumentOptions['onDelete'], ); @@ -352,22 +362,52 @@ function updateAttribute( $relatedCollection = $dbForProject->getDocument('database_' . $db->getInternalId(), $primaryDocumentOptions['relatedCollection']); $relatedAttribute = $dbForProject->getDocument('attributes', $db->getInternalId() . '_' . $relatedCollection->getInternalId() . '_' . $primaryDocumentOptions['twoWayKey']); + + if (!empty($newKey) && $newKey !== $key) { + $options['twoWayKey'] = $newKey; + } + $relatedOptions = \array_merge($relatedAttribute->getAttribute('options'), $options); $relatedAttribute->setAttribute('options', $relatedOptions); $dbForProject->updateDocument('attributes', $db->getInternalId() . '_' . $relatedCollection->getInternalId() . '_' . $primaryDocumentOptions['twoWayKey'], $relatedAttribute); + $dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $relatedCollection->getId()); } } else { - $dbForProject->updateAttribute( - collection: $collectionId, - id: $key, - required: $required, - default: $default, - formatOptions: $options ?? null - ); + try { + $dbForProject->updateAttribute( + collection: $collectionId, + id: $key, + size: $size, + required: $required, + default: $default, + formatOptions: $options ?? null, + newKey: $newKey ?? null + ); + } catch (TruncateException) { + throw new Exception(Exception::ATTRIBUTE_INVALID_RESIZE); + } + } + + if (!empty($newKey) && $key !== $newKey) { + // Delete attribute and recreate since we can't modify IDs + $original = clone $attribute; + + $dbForProject->deleteDocument('attributes', $attribute->getId()); + + $attribute + ->setAttribute('$id', ID::custom($db->getInternalId() . '_' . $collection->getInternalId() . '_' . $newKey)) + ->setAttribute('key', $newKey); + + try { + $attribute = $dbForProject->createDocument('attributes', $attribute); + } catch (DatabaseException|PDOException) { + $attribute = $dbForProject->createDocument('attributes', $original); + } + } else { + $attribute = $dbForProject->updateDocument('attributes', $db->getInternalId() . '_' . $collection->getInternalId() . '_' . $key, $attribute); } - $attribute = $dbForProject->updateDocument('attributes', $db->getInternalId() . '_' . $collection->getInternalId() . '_' . $key, $attribute); $dbForProject->purgeCachedDocument('database_' . $db->getInternalId(), $collection->getId()); $queueForEvents @@ -1152,6 +1192,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string 'filters' => $filters, ]), $response, $dbForProject, $queueForDatabase, $queueForEvents); + $response ->setStatusCode(Response::STATUS_CODE_ACCEPTED) ->dynamic($attribute, Response::MODEL_ATTRIBUTE_STRING); @@ -1859,10 +1900,12 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/strin ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new Text(0, 0)), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('size', null, new Integer(), 'Maximum size of the string attribute.', true) + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?int $size, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, @@ -1871,8 +1914,10 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/strin dbForProject: $dbForProject, queueForEvents: $queueForEvents, type: Database::VAR_STRING, + size: $size, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -1898,10 +1943,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/email ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new Email()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -1911,7 +1957,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/email type: Database::VAR_STRING, filter: APP_DATABASE_ATTRIBUTE_EMAIL, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -1938,10 +1985,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/enum/ ->param('elements', null, new ArrayList(new Text(DATABASE::LENGTH_KEY), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of elements in enumerated type. Uses length of longest element to determine size. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' elements are allowed, each ' . DATABASE::LENGTH_KEY . ' characters long.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new Text(0)), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?array $elements, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?array $elements, ?bool $required, ?string $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -1952,7 +2000,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/enum/ filter: APP_DATABASE_ATTRIBUTE_ENUM, default: $default, required: $required, - elements: $elements + elements: $elements, + newKey: $newKey ); $response @@ -1978,10 +2027,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/ip/:k ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new IP()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -1991,7 +2041,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/ip/:k type: Database::VAR_STRING, filter: APP_DATABASE_ATTRIBUTE_IP, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -2017,10 +2068,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/url/: ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new URL()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -2030,7 +2082,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/url/: type: Database::VAR_STRING, filter: APP_DATABASE_ATTRIBUTE_URL, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -2058,10 +2111,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/integ ->param('min', null, new Integer(), 'Minimum value to enforce on new documents') ->param('max', null, new Integer(), 'Maximum value to enforce on new documents') ->param('default', null, new Nullable(new Integer()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?int $min, ?int $max, ?int $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?int $min, ?int $max, ?int $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -2072,7 +2126,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/integ default: $default, required: $required, min: $min, - max: $max + max: $max, + newKey: $newKey ); $formatOptions = $attribute->getAttribute('formatOptions', []); @@ -2107,10 +2162,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/float ->param('min', null, new FloatValidator(), 'Minimum value to enforce on new documents') ->param('max', null, new FloatValidator(), 'Maximum value to enforce on new documents') ->param('default', null, new Nullable(new FloatValidator()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?float $min, ?float $max, ?float $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?float $min, ?float $max, ?float $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -2121,7 +2177,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/float default: $default, required: $required, min: $min, - max: $max + max: $max, + newKey: $newKey ); $formatOptions = $attribute->getAttribute('formatOptions', []); @@ -2154,10 +2211,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/boole ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new Boolean()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?bool $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?bool $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -2166,7 +2224,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/boole queueForEvents: $queueForEvents, type: Database::VAR_BOOLEAN, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -2192,10 +2251,11 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/datet ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') ->param('default', null, new Nullable(new DatetimeValidator()), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') - ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, Response $response, Database $dbForProject, Event $queueForEvents) { + ->action(function (string $databaseId, string $collectionId, string $key, ?bool $required, ?string $default, ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents) { $attribute = updateAttribute( databaseId: $databaseId, collectionId: $collectionId, @@ -2204,7 +2264,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/datet queueForEvents: $queueForEvents, type: Database::VAR_DATETIME, default: $default, - required: $required + required: $required, + newKey: $newKey ); $response @@ -2229,6 +2290,7 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/:key/ ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('key', '', new Key(), 'Attribute Key.') ->param('onDelete', null, new WhiteList([Database::RELATION_MUTATE_CASCADE, Database::RELATION_MUTATE_RESTRICT, Database::RELATION_MUTATE_SET_NULL], true), 'Constraints option', true) + ->param('newKey', null, new Key(), 'New attribute key.', true) ->inject('response') ->inject('dbForProject') ->inject('queueForEvents') @@ -2237,6 +2299,7 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/:key/ string $collectionId, string $key, ?string $onDelete, + ?string $newKey, Response $response, Database $dbForProject, Event $queueForEvents @@ -2251,7 +2314,8 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/:key/ required: false, options: [ 'onDelete' => $onDelete - ] + ], + newKey: $newKey ); $options = $attribute->getAttribute('options', []); diff --git a/app/init.php b/app/init.php index 2a5e29803c..9540de57de 100644 --- a/app/init.php +++ b/app/init.php @@ -223,8 +223,8 @@ const API_KEY_DYNAMIC = 'dynamic'; // Usage metrics const METRIC_TEAMS = 'teams'; const METRIC_USERS = 'users'; -const METRIC_MESSAGES = 'messages'; -const METRIC_MESSAGES_COUNTRY_CODE = '{countryCode}.messages'; +const METRIC_AUTH_METHOD_PHONE = 'auth.method.phone'; +const METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE = METRIC_AUTH_METHOD_PHONE . '.{countryCode}'; const METRIC_SESSIONS = 'sessions'; const METRIC_DATABASES = 'databases'; const METRIC_COLLECTIONS = 'collections'; diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index eda5fa1af2..991bb09d7d 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -166,7 +166,7 @@ $image = $this->getParam('image', ''); appwrite-console: <<: *x-logging container_name: appwrite-console - image: /console:5.0.10 + image: /console:5.0.11 restart: unless-stopped networks: - appwrite diff --git a/composer.json b/composer.json index d572d502a7..91ff1eeb92 100644 --- a/composer.json +++ b/composer.json @@ -45,13 +45,13 @@ "ext-sockets": "*", "appwrite/php-runtimes": "0.15.*", "appwrite/php-clamav": "2.0.*", - "utopia-php/abuse": "0.42.0", + "utopia-php/abuse": "0.43.0", "utopia-php/analytics": "0.10.*", - "utopia-php/audit": "0.42.0", + "utopia-php/audit": "0.43.0", "utopia-php/cache": "0.10.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.52.*", + "utopia-php/database": "0.53.*", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", "utopia-php/framework": "0.33.*", diff --git a/composer.lock b/composer.lock index 469eb531c1..aac1554dbf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eba741eab8bb748ed684c32711d472df", + "content-hash": "b6820da26239716cf14a445697902a03", "packages": [ { "name": "adhocore/jwt", @@ -1429,16 +1429,16 @@ }, { "name": "utopia-php/abuse", - "version": "0.42.0", + "version": "0.43.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "08cf17e7f4fd213966c8d8702e406f2269244f0f" + "reference": "6346a3b4c5177a43160035a7289e30fdfb0790d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/08cf17e7f4fd213966c8d8702e406f2269244f0f", - "reference": "08cf17e7f4fd213966c8d8702e406f2269244f0f", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/6346a3b4c5177a43160035a7289e30fdfb0790d6", + "reference": "6346a3b4c5177a43160035a7289e30fdfb0790d6", "shasum": "" }, "require": { @@ -1446,7 +1446,7 @@ "ext-pdo": "*", "ext-redis": "*", "php": ">=8.0", - "utopia-php/database": "0.52.*" + "utopia-php/database": "0.53.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1474,9 +1474,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.42.0" + "source": "https://github.com/utopia-php/abuse/tree/0.43.0" }, - "time": "2024-08-21T08:24:01+00:00" + "time": "2024-08-30T05:17:23+00:00" }, { "name": "utopia-php/analytics", @@ -1526,21 +1526,21 @@ }, { "name": "utopia-php/audit", - "version": "0.42.0", + "version": "0.43.0", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "9dc168470625bcf11ff8cd9ab5660db09129f618" + "reference": "cef22b5dc6a6d28fcd522f41c7bf7ded4a4dfd3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/9dc168470625bcf11ff8cd9ab5660db09129f618", - "reference": "9dc168470625bcf11ff8cd9ab5660db09129f618", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/cef22b5dc6a6d28fcd522f41c7bf7ded4a4dfd3e", + "reference": "cef22b5dc6a6d28fcd522f41c7bf7ded4a4dfd3e", "shasum": "" }, "require": { "php": ">=8.0", - "utopia-php/database": "0.52.*" + "utopia-php/database": "0.53.*" }, "require-dev": { "laravel/pint": "1.5.*", @@ -1567,9 +1567,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/0.42.0" + "source": "https://github.com/utopia-php/audit/tree/0.43.0" }, - "time": "2024-08-21T08:24:08+00:00" + "time": "2024-08-30T05:17:36+00:00" }, { "name": "utopia-php/cache", @@ -1723,16 +1723,16 @@ }, { "name": "utopia-php/database", - "version": "0.52.2", + "version": "0.53.4", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "24b29bcac7eb7a8b81698a80bb75fc5909f4975e" + "reference": "36a0e89d983afc1368635282e04fa762220a1d2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/24b29bcac7eb7a8b81698a80bb75fc5909f4975e", - "reference": "24b29bcac7eb7a8b81698a80bb75fc5909f4975e", + "url": "https://api.github.com/repos/utopia-php/database/zipball/36a0e89d983afc1368635282e04fa762220a1d2a", + "reference": "36a0e89d983afc1368635282e04fa762220a1d2a", "shasum": "" }, "require": { @@ -1773,9 +1773,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.52.2" + "source": "https://github.com/utopia-php/database/tree/0.53.4" }, - "time": "2024-09-02T06:28:50+00:00" + "time": "2024-09-10T10:19:57+00:00" }, { "name": "utopia-php/domains", @@ -2993,16 +2993,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.39.18", + "version": "0.39.19", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c" + "reference": "d5653a2f744d2c297d44f99ff68bfc26c1a3b804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c", - "reference": "3f12532d3a41f6e3e7528f41c0e79a6d473c4a4c", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d5653a2f744d2c297d44f99ff68bfc26c1a3b804", + "reference": "d5653a2f744d2c297d44f99ff68bfc26c1a3b804", "shasum": "" }, "require": { @@ -3038,9 +3038,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.39.18" + "source": "https://github.com/appwrite/sdk-generator/tree/0.39.19" }, - "time": "2024-08-27T11:22:14+00:00" + "time": "2024-08-30T12:04:18+00:00" }, { "name": "doctrine/annotations", diff --git a/docker-compose.yml b/docker-compose.yml index 502c9dcd5c..301ba3564c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -196,7 +196,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:5.0.10 + image: appwrite/console:5.0.11 restart: unless-stopped networks: - appwrite diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-boolean-attribute.md index d6668bf3a1..82b4c3ca2d 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-boolean-attribute.md @@ -11,7 +11,8 @@ const result = await databases.updateBooleanAttribute( '', // collectionId '', // key false, // required - false // default + false, // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-datetime-attribute.md index 4dc65e7b3b..453b2f369d 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-datetime-attribute.md @@ -11,7 +11,8 @@ const result = await databases.updateDatetimeAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-email-attribute.md index 39aa7189ff..581d7ab48e 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-email-attribute.md @@ -11,7 +11,8 @@ const result = await databases.updateEmailAttribute( '', // collectionId '', // key false, // required - 'email@example.com' // default + 'email@example.com', // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-enum-attribute.md index 81a9fa57f0..999335a27e 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-enum-attribute.md @@ -12,7 +12,8 @@ const result = await databases.updateEnumAttribute( '', // key [], // elements false, // required - '' // default + '', // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-float-attribute.md index 6c820f4505..8d6d423f65 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-float-attribute.md @@ -13,7 +13,8 @@ const result = await databases.updateFloatAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-integer-attribute.md index 5fdfedeea2..727c016455 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-integer-attribute.md @@ -13,7 +13,8 @@ const result = await databases.updateIntegerAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-ip-attribute.md index 2a6267d6e6..f2a018c4b4 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-ip-attribute.md @@ -11,7 +11,8 @@ const result = await databases.updateIpAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-relationship-attribute.md index 934590d525..bc5f41cf92 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-relationship-attribute.md @@ -10,7 +10,8 @@ const result = await databases.updateRelationshipAttribute( '', // databaseId '', // collectionId '', // key - RelationMutate.Cascade // onDelete (optional) + RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-string-attribute.md index 0d9bc97823..0ac1497d00 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-string-attribute.md @@ -11,7 +11,9 @@ const result = await databases.updateStringAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + null, // size (optional) + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/console-web/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/console-web/examples/databases/update-url-attribute.md index c1836ed6ce..e09220304e 100644 --- a/docs/examples/1.6.x/console-web/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/console-web/examples/databases/update-url-attribute.md @@ -11,7 +11,8 @@ const result = await databases.updateUrlAttribute( '', // collectionId '', // key false, // required - 'https://example.com' // default + 'https://example.com', // default + '' // newKey (optional) ); console.log(result); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-boolean-attribute.md index 197116bd51..489ce4099a 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-boolean-attribute.md @@ -13,4 +13,5 @@ AttributeBoolean result = await databases.updateBooleanAttribute( key: '', xrequired: false, xdefault: false, + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-datetime-attribute.md index ab787e536d..73f61e26d7 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-datetime-attribute.md @@ -13,4 +13,5 @@ AttributeDatetime result = await databases.updateDatetimeAttribute( key: '', xrequired: false, xdefault: '', + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-email-attribute.md index baa41b3080..37bcd4d7e7 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-email-attribute.md @@ -13,4 +13,5 @@ AttributeEmail result = await databases.updateEmailAttribute( key: '', xrequired: false, xdefault: 'email@example.com', + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-enum-attribute.md index 847f8b3820..f47078c891 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-enum-attribute.md @@ -14,4 +14,5 @@ AttributeEnum result = await databases.updateEnumAttribute( elements: [], xrequired: false, xdefault: '', + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-float-attribute.md index e8656bfb0e..8e023bc457 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-float-attribute.md @@ -15,4 +15,5 @@ AttributeFloat result = await databases.updateFloatAttribute( min: 0, max: 0, xdefault: 0, + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-integer-attribute.md index 3175ebfb92..1dac743a27 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-integer-attribute.md @@ -15,4 +15,5 @@ AttributeInteger result = await databases.updateIntegerAttribute( min: 0, max: 0, xdefault: 0, + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-ip-attribute.md index 0270349e1f..dc83bd0043 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-ip-attribute.md @@ -13,4 +13,5 @@ AttributeIp result = await databases.updateIpAttribute( key: '', xrequired: false, xdefault: '', + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-relationship-attribute.md index 37106ee53c..6d14f52d19 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-relationship-attribute.md @@ -12,4 +12,5 @@ AttributeRelationship result = await databases.updateRelationshipAttribute( collectionId: '', key: '', onDelete: RelationMutate.cascade, // (optional) + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-string-attribute.md index 6e08af2f82..c2f3804c66 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-string-attribute.md @@ -13,4 +13,6 @@ AttributeString result = await databases.updateStringAttribute( key: '', xrequired: false, xdefault: '', + size: 0, // (optional) + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-dart/examples/databases/update-url-attribute.md index c14537fb0e..20c11fafc5 100644 --- a/docs/examples/1.6.x/server-dart/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-dart/examples/databases/update-url-attribute.md @@ -13,4 +13,5 @@ AttributeUrl result = await databases.updateUrlAttribute( key: '', xrequired: false, xdefault: 'https://example.com', + newKey: '', // (optional) ); diff --git a/docs/examples/1.6.x/server-dart/examples/functions/create-deployment.md b/docs/examples/1.6.x/server-dart/examples/functions/create-deployment.md index d098366ed5..297bdc612a 100644 --- a/docs/examples/1.6.x/server-dart/examples/functions/create-deployment.md +++ b/docs/examples/1.6.x/server-dart/examples/functions/create-deployment.md @@ -1,3 +1,4 @@ +import 'dart:io'; import 'package:dart_appwrite/dart_appwrite.dart'; Client client = Client() diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-boolean-attribute.md index 3019e7149e..dc107667aa 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-boolean-attribute.md @@ -12,5 +12,6 @@ const response = await databases.updateBooleanAttribute( '', // collectionId '', // key false, // required - false // default + false, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-datetime-attribute.md index 2517bb06ef..7de5a2c847 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-datetime-attribute.md @@ -12,5 +12,6 @@ const response = await databases.updateDatetimeAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-email-attribute.md index 98dba02f7a..41df182651 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-email-attribute.md @@ -12,5 +12,6 @@ const response = await databases.updateEmailAttribute( '', // collectionId '', // key false, // required - 'email@example.com' // default + 'email@example.com', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-enum-attribute.md index 4b2b5f1e88..6c0f9127b0 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-enum-attribute.md @@ -13,5 +13,6 @@ const response = await databases.updateEnumAttribute( '', // key [], // elements false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-float-attribute.md index 45acc53917..fef0c8c6b4 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-float-attribute.md @@ -14,5 +14,6 @@ const response = await databases.updateFloatAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-integer-attribute.md index 481b6bb094..18db8ddc0d 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-integer-attribute.md @@ -14,5 +14,6 @@ const response = await databases.updateIntegerAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-ip-attribute.md index 8fe55ae7fb..9348cfa0b4 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-ip-attribute.md @@ -12,5 +12,6 @@ const response = await databases.updateIpAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-relationship-attribute.md index 0fe97b9099..3d0bfdd916 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-relationship-attribute.md @@ -11,5 +11,6 @@ const response = await databases.updateRelationshipAttribute( '', // databaseId '', // collectionId '', // key - RelationMutate.Cascade // onDelete (optional) + RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-string-attribute.md index 6424c7d3d9..6603c377cb 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-string-attribute.md @@ -12,5 +12,7 @@ const response = await databases.updateStringAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + null, // size (optional) + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-deno/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-deno/examples/databases/update-url-attribute.md index 3c3a128f8d..f1027d84b6 100644 --- a/docs/examples/1.6.x/server-deno/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-deno/examples/databases/update-url-attribute.md @@ -12,5 +12,6 @@ const response = await databases.updateUrlAttribute( '', // collectionId '', // key false, // required - 'https://example.com' // default + 'https://example.com', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-boolean-attribute.md index 95910196ca..7c435f51ce 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-boolean-attribute.md @@ -14,5 +14,6 @@ AttributeBoolean result = await databases.UpdateBooleanAttribute( collectionId: "", key: "", required: false, - default: false + default: false, + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-datetime-attribute.md index 4f94634031..a8208202c8 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-datetime-attribute.md @@ -14,5 +14,6 @@ AttributeDatetime result = await databases.UpdateDatetimeAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-email-attribute.md index ff6d9f6771..f7dde2ac2f 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-email-attribute.md @@ -14,5 +14,6 @@ AttributeEmail result = await databases.UpdateEmailAttribute( collectionId: "", key: "", required: false, - default: "email@example.com" + default: "email@example.com", + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-enum-attribute.md index 456a65f1c5..6abd3a607c 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-enum-attribute.md @@ -15,5 +15,6 @@ AttributeEnum result = await databases.UpdateEnumAttribute( key: "", elements: new List(), required: false, - default: "" + default: "", + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-float-attribute.md index 5aecfb688c..2e5e7dde6b 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-float-attribute.md @@ -16,5 +16,6 @@ AttributeFloat result = await databases.UpdateFloatAttribute( required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-integer-attribute.md index 97639d0359..da074ba7d5 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-integer-attribute.md @@ -16,5 +16,6 @@ AttributeInteger result = await databases.UpdateIntegerAttribute( required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-ip-attribute.md index 6127769c74..0be862b004 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-ip-attribute.md @@ -14,5 +14,6 @@ AttributeIp result = await databases.UpdateIpAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-relationship-attribute.md index c3439fb500..b49f72ccf8 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-relationship-attribute.md @@ -14,5 +14,6 @@ AttributeRelationship result = await databases.UpdateRelationshipAttribute( databaseId: "", collectionId: "", key: "", - onDelete: RelationMutate.Cascade // optional + onDelete: RelationMutate.Cascade, // optional + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-string-attribute.md index b59aba36c3..e915d23f51 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-string-attribute.md @@ -14,5 +14,7 @@ AttributeString result = await databases.UpdateStringAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + size: 0, // optional + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-dotnet/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-dotnet/examples/databases/update-url-attribute.md index 50a6753d39..30a9a6298a 100644 --- a/docs/examples/1.6.x/server-dotnet/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-dotnet/examples/databases/update-url-attribute.md @@ -14,5 +14,6 @@ AttributeUrl result = await databases.UpdateUrlAttribute( collectionId: "", key: "", required: false, - default: "https://example.com" + default: "https://example.com", + newKey: "" // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-boolean-attribute.md index 014034428c..b5386f0111 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-boolean-attribute.md @@ -20,6 +20,7 @@ func main() { "", false, false, + databases.WithUpdateBooleanAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-datetime-attribute.md index 15707afe40..53a66e8cfe 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-datetime-attribute.md @@ -20,6 +20,7 @@ func main() { "", false, "", + databases.WithUpdateDatetimeAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-email-attribute.md index 1efba5889b..0dd72beb4b 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-email-attribute.md @@ -20,6 +20,7 @@ func main() { "", false, "email@example.com", + databases.WithUpdateEmailAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-enum-attribute.md index fb4a58ed66..aec51772ee 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-enum-attribute.md @@ -21,6 +21,7 @@ func main() { []interface{}{}, false, "", + databases.WithUpdateEnumAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-float-attribute.md index 1f77093130..f7b40a299d 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-float-attribute.md @@ -22,6 +22,7 @@ func main() { 0, 0, 0, + databases.WithUpdateFloatAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-integer-attribute.md index b972aaa0de..705d92c8aa 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-integer-attribute.md @@ -22,6 +22,7 @@ func main() { 0, 0, 0, + databases.WithUpdateIntegerAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-ip-attribute.md index ff28148900..b47672c530 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-ip-attribute.md @@ -20,6 +20,7 @@ func main() { "", false, "", + databases.WithUpdateIpAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-relationship-attribute.md index 22d5f16a80..7deadc7c15 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-relationship-attribute.md @@ -19,6 +19,7 @@ func main() { "", "", databases.WithUpdateRelationshipAttributeOnDelete("cascade"), + databases.WithUpdateRelationshipAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-string-attribute.md index fd95d68ff2..d662060f09 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-string-attribute.md @@ -20,6 +20,8 @@ func main() { "", false, "", + databases.WithUpdateStringAttributeSize(0), + databases.WithUpdateStringAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-go/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-go/examples/databases/update-url-attribute.md index eaee9ecd6a..98dc66fa99 100644 --- a/docs/examples/1.6.x/server-go/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-go/examples/databases/update-url-attribute.md @@ -20,6 +20,7 @@ func main() { "", false, "https://example.com", + databases.WithUpdateUrlAttributeNewKey(""), ) if error != nil { diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-boolean-attribute.md index 4c9aa62ef0..e92b41a14e 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-boolean-attribute.md @@ -4,7 +4,8 @@ mutation { collectionId: "", key: "", required: false, - default: false + default: false, + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-datetime-attribute.md index 3da4483837..46d9bbb728 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-datetime-attribute.md @@ -4,7 +4,8 @@ mutation { collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-email-attribute.md index 36dd14d646..e05d365162 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-email-attribute.md @@ -4,7 +4,8 @@ mutation { collectionId: "", key: "", required: false, - default: "email@example.com" + default: "email@example.com", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-enum-attribute.md index f2954f070f..619cbf817c 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-enum-attribute.md @@ -5,7 +5,8 @@ mutation { key: "", elements: [], required: false, - default: "" + default: "", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-float-attribute.md index de987485a7..7641745a35 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-float-attribute.md @@ -6,7 +6,8 @@ mutation { required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-integer-attribute.md index 34ceca93af..11b7a66014 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-integer-attribute.md @@ -6,7 +6,8 @@ mutation { required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-ip-attribute.md index a3a2aec585..649fa881b5 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-ip-attribute.md @@ -4,7 +4,8 @@ mutation { collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-relationship-attribute.md index aa994f14ae..88ba2f9636 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-relationship-attribute.md @@ -3,7 +3,8 @@ mutation { databaseId: "", collectionId: "", key: "", - onDelete: "cascade" + onDelete: "cascade", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-string-attribute.md index cc98a1a177..4d88462efb 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-string-attribute.md @@ -4,7 +4,9 @@ mutation { collectionId: "", key: "", required: false, - default: "" + default: "", + size: 0, + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-graphql/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-graphql/examples/databases/update-url-attribute.md index e94723efe1..06838a9ed4 100644 --- a/docs/examples/1.6.x/server-graphql/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-graphql/examples/databases/update-url-attribute.md @@ -4,7 +4,8 @@ mutation { collectionId: "", key: "", required: false, - default: "https://example.com" + default: "https://example.com", + newKey: "" ) { key type diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-boolean-attribute.md index 45f2a0e9a4..01a8ba13d3 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-boolean-attribute.md @@ -15,6 +15,7 @@ databases.updateBooleanAttribute( "", // key false, // required false, // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-datetime-attribute.md index 14cbf5857d..00b35689d3 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-datetime-attribute.md @@ -15,6 +15,7 @@ databases.updateDatetimeAttribute( "", // key false, // required "", // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-email-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-email-attribute.md index 6e3cd19c49..b931370189 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-email-attribute.md @@ -15,6 +15,7 @@ databases.updateEmailAttribute( "", // key false, // required "email@example.com", // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-enum-attribute.md index 19d47519f0..febf784f96 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-enum-attribute.md @@ -16,6 +16,7 @@ databases.updateEnumAttribute( listOf(), // elements false, // required "", // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-float-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-float-attribute.md index 663fc23098..071bd48df0 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-float-attribute.md @@ -17,6 +17,7 @@ databases.updateFloatAttribute( 0, // min 0, // max 0, // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-integer-attribute.md index ff44d93b6a..b6c1e449ba 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-integer-attribute.md @@ -17,6 +17,7 @@ databases.updateIntegerAttribute( 0, // min 0, // max 0, // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-ip-attribute.md index 740c8df27f..72b85cf531 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-ip-attribute.md @@ -15,6 +15,7 @@ databases.updateIpAttribute( "", // key false, // required "", // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-relationship-attribute.md index 2beba61362..73e21218b1 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-relationship-attribute.md @@ -14,6 +14,7 @@ databases.updateRelationshipAttribute( "", // collectionId "", // key RelationMutate.CASCADE, // onDelete (optional) + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-string-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-string-attribute.md index 021b8e125c..75be9e01f8 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-string-attribute.md @@ -15,6 +15,8 @@ databases.updateStringAttribute( "", // key false, // required "", // default + 0, // size (optional) + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/java/databases/update-url-attribute.md b/docs/examples/1.6.x/server-kotlin/java/databases/update-url-attribute.md index 92d5c39b6c..dcfbf3065d 100644 --- a/docs/examples/1.6.x/server-kotlin/java/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/java/databases/update-url-attribute.md @@ -15,6 +15,7 @@ databases.updateUrlAttribute( "", // key false, // required "https://example.com", // default + "", // newKey (optional) new CoroutineCallback<>((result, error) -> { if (error != null) { error.printStackTrace(); diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-boolean-attribute.md index f476bd18cd..ebffab74f2 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-boolean-attribute.md @@ -14,5 +14,6 @@ val response = databases.updateBooleanAttribute( collectionId = "", key = "", required = false, - default = false + default = false, + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-datetime-attribute.md index 88133b8698..676c779bc9 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-datetime-attribute.md @@ -14,5 +14,6 @@ val response = databases.updateDatetimeAttribute( collectionId = "", key = "", required = false, - default = "" + default = "", + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-email-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-email-attribute.md index 0599707b72..2f1cbd2527 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-email-attribute.md @@ -14,5 +14,6 @@ val response = databases.updateEmailAttribute( collectionId = "", key = "", required = false, - default = "email@example.com" + default = "email@example.com", + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-enum-attribute.md index 43a0230c33..7c0c92fad6 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-enum-attribute.md @@ -15,5 +15,6 @@ val response = databases.updateEnumAttribute( key = "", elements = listOf(), required = false, - default = "" + default = "", + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-float-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-float-attribute.md index 87501b7cc8..4701530831 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-float-attribute.md @@ -16,5 +16,6 @@ val response = databases.updateFloatAttribute( required = false, min = 0, max = 0, - default = 0 + default = 0, + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-integer-attribute.md index 724c21b0c9..e5742a5830 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-integer-attribute.md @@ -16,5 +16,6 @@ val response = databases.updateIntegerAttribute( required = false, min = 0, max = 0, - default = 0 + default = 0, + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-ip-attribute.md index 68067aede3..bfc0cddce0 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-ip-attribute.md @@ -14,5 +14,6 @@ val response = databases.updateIpAttribute( collectionId = "", key = "", required = false, - default = "" + default = "", + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-relationship-attribute.md index 2ef905a574..ab12195140 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-relationship-attribute.md @@ -13,5 +13,6 @@ val response = databases.updateRelationshipAttribute( databaseId = "", collectionId = "", key = "", - onDelete = "cascade" // optional + onDelete = "cascade", // optional + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-string-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-string-attribute.md index c89976c074..a37d4566ee 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-string-attribute.md @@ -14,5 +14,7 @@ val response = databases.updateStringAttribute( collectionId = "", key = "", required = false, - default = "" + default = "", + size = 0, // optional + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-url-attribute.md b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-url-attribute.md index 4848a3ec16..78351133db 100644 --- a/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-kotlin/kotlin/databases/update-url-attribute.md @@ -14,5 +14,6 @@ val response = databases.updateUrlAttribute( collectionId = "", key = "", required = false, - default = "https://example.com" + default = "https://example.com", + newKey = "" // optional ) diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-boolean-attribute.md index ae4a91cfc2..e6329b6674 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-boolean-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateBooleanAttribute( '', // collectionId '', // key false, // required - false // default + false, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-datetime-attribute.md index 9dfcf7541c..ef69c7e4b5 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-datetime-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateDatetimeAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-email-attribute.md index f42c464cc1..1fe9e572d4 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-email-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateEmailAttribute( '', // collectionId '', // key false, // required - 'email@example.com' // default + 'email@example.com', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-enum-attribute.md index e8dd97d8c3..ec9e3bd2cb 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-enum-attribute.md @@ -13,5 +13,6 @@ const result = await databases.updateEnumAttribute( '', // key [], // elements false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-float-attribute.md index 67cb29ff92..6833f876e7 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-float-attribute.md @@ -14,5 +14,6 @@ const result = await databases.updateFloatAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-integer-attribute.md index baf374e240..d6d16f52a8 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-integer-attribute.md @@ -14,5 +14,6 @@ const result = await databases.updateIntegerAttribute( false, // required null, // min null, // max - null // default + null, // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-ip-attribute.md index 64bde38bd2..019b4f2dbf 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-ip-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateIpAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-relationship-attribute.md index 403f591dec..2668380b50 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-relationship-attribute.md @@ -11,5 +11,6 @@ const result = await databases.updateRelationshipAttribute( '', // databaseId '', // collectionId '', // key - sdk.RelationMutate.Cascade // onDelete (optional) + sdk.RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-string-attribute.md index c21784b79c..f379fdc0cf 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-string-attribute.md @@ -12,5 +12,7 @@ const result = await databases.updateStringAttribute( '', // collectionId '', // key false, // required - '' // default + '', // default + null, // size (optional) + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-nodejs/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-nodejs/examples/databases/update-url-attribute.md index 6a8434a046..36d1095399 100644 --- a/docs/examples/1.6.x/server-nodejs/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-nodejs/examples/databases/update-url-attribute.md @@ -12,5 +12,6 @@ const result = await databases.updateUrlAttribute( '', // collectionId '', // key false, // required - 'https://example.com' // default + 'https://example.com', // default + '' // newKey (optional) ); diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-boolean-attribute.md index 1b3355a3e2..133fbb8b47 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-boolean-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateBooleanAttribute( collectionId: '', key: '', required: false, - default: false + default: false, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-datetime-attribute.md index 978cde0a05..4773e54537 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-datetime-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateDatetimeAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-email-attribute.md index 1623b64ab1..9c1bdb48bd 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-email-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateEmailAttribute( collectionId: '', key: '', required: false, - default: 'email@example.com' + default: 'email@example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-enum-attribute.md index 8a8d035761..88229bc999 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-enum-attribute.md @@ -16,5 +16,6 @@ $result = $databases->updateEnumAttribute( key: '', elements: [], required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-float-attribute.md index 105ebc6975..7beac26ea2 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-float-attribute.md @@ -17,5 +17,6 @@ $result = $databases->updateFloatAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-integer-attribute.md index 65bed51ca0..e92385d2bf 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-integer-attribute.md @@ -17,5 +17,6 @@ $result = $databases->updateIntegerAttribute( required: false, min: null, max: null, - default: null + default: null, + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-ip-attribute.md index f7ce1a6033..e88e75c2b6 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-ip-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateIpAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-relationship-attribute.md index a0ba877e52..0afaea27b5 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-relationship-attribute.md @@ -14,5 +14,6 @@ $result = $databases->updateRelationshipAttribute( databaseId: '', collectionId: '', key: '', - onDelete: RelationMutate::CASCADE() // optional + onDelete: RelationMutate::CASCADE(), // optional + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-string-attribute.md index 08c5c5e0b1..9e821e4436 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-string-attribute.md @@ -15,5 +15,7 @@ $result = $databases->updateStringAttribute( collectionId: '', key: '', required: false, - default: '' + default: '', + size: null, // optional + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-php/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-php/examples/databases/update-url-attribute.md index 9595176523..1825e55845 100644 --- a/docs/examples/1.6.x/server-php/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-php/examples/databases/update-url-attribute.md @@ -15,5 +15,6 @@ $result = $databases->updateUrlAttribute( collectionId: '', key: '', required: false, - default: 'https://example.com' + default: 'https://example.com', + newKey: '' // optional ); \ No newline at end of file diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-boolean-attribute.md index 8afccf9cf2..553d94b109 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-boolean-attribute.md @@ -12,5 +12,6 @@ result = databases.update_boolean_attribute( collection_id = '', key = '', required = False, - default = False + default = False, + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-datetime-attribute.md index c85a60edad..f9056d2c39 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-datetime-attribute.md @@ -12,5 +12,6 @@ result = databases.update_datetime_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-email-attribute.md index cb9bc422b1..45a8d0d9bc 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-email-attribute.md @@ -12,5 +12,6 @@ result = databases.update_email_attribute( collection_id = '', key = '', required = False, - default = 'email@example.com' + default = 'email@example.com', + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-enum-attribute.md index 5336cbfe02..c07f3754d8 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-enum-attribute.md @@ -13,5 +13,6 @@ result = databases.update_enum_attribute( key = '', elements = [], required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-float-attribute.md index 23d1f810cd..fa1767e893 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-float-attribute.md @@ -14,5 +14,6 @@ result = databases.update_float_attribute( required = False, min = None, max = None, - default = None + default = None, + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-integer-attribute.md index d9206af42e..0db97070ed 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-integer-attribute.md @@ -14,5 +14,6 @@ result = databases.update_integer_attribute( required = False, min = None, max = None, - default = None + default = None, + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-ip-attribute.md index 7370d09467..135dbd82ea 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-ip-attribute.md @@ -12,5 +12,6 @@ result = databases.update_ip_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-relationship-attribute.md index 3221865cfc..bc528f17dd 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-relationship-attribute.md @@ -11,5 +11,6 @@ result = databases.update_relationship_attribute( database_id = '', collection_id = '', key = '', - on_delete = RelationMutate.CASCADE # optional + on_delete = RelationMutate.CASCADE, # optional + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-string-attribute.md index 0741d36beb..bbe7ddb19f 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-string-attribute.md @@ -12,5 +12,7 @@ result = databases.update_string_attribute( collection_id = '', key = '', required = False, - default = '' + default = '', + size = None, # optional + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-python/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-python/examples/databases/update-url-attribute.md index d240be22cd..8e3a28de1f 100644 --- a/docs/examples/1.6.x/server-python/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-python/examples/databases/update-url-attribute.md @@ -12,5 +12,6 @@ result = databases.update_url_attribute( collection_id = '', key = '', required = False, - default = 'https://example.com' + default = 'https://example.com', + new_key = '' # optional ) diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-boolean-attribute.md index a064a833af..fabc1a17c2 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-boolean-attribute.md @@ -7,5 +7,6 @@ X-Appwrite-Key: { "required": false, - "default": false + "default": false, + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-datetime-attribute.md index 1d5930352a..456d496f67 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-datetime-attribute.md @@ -7,5 +7,6 @@ X-Appwrite-Key: { "required": false, - "default": + "default": , + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-email-attribute.md index 3f734772dd..71b1a3b852 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-email-attribute.md @@ -7,5 +7,6 @@ X-Appwrite-Key: { "required": false, - "default": "email@example.com" + "default": "email@example.com", + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-enum-attribute.md index 01254f0fd5..c686fc5882 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-enum-attribute.md @@ -8,5 +8,6 @@ X-Appwrite-Key: { "elements": [], "required": false, - "default": "" + "default": "", + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-float-attribute.md index 0bb8869dec..029f7dccb4 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-float-attribute.md @@ -9,5 +9,6 @@ X-Appwrite-Key: "required": false, "min": 0, "max": 0, - "default": 0 + "default": 0, + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-integer-attribute.md index b9c6e9b3f6..3a575e0dc5 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-integer-attribute.md @@ -9,5 +9,6 @@ X-Appwrite-Key: "required": false, "min": 0, "max": 0, - "default": 0 + "default": 0, + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-ip-attribute.md index a4d4f5f89f..a4b6ae9061 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-ip-attribute.md @@ -7,5 +7,6 @@ X-Appwrite-Key: { "required": false, - "default": + "default": , + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-relationship-attribute.md index 0b75082dd7..8e1901d65e 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-relationship-attribute.md @@ -6,5 +6,6 @@ X-Appwrite-Project: X-Appwrite-Key: { - "onDelete": "cascade" + "onDelete": "cascade", + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-string-attribute.md index ece858dd31..197ea2767d 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-string-attribute.md @@ -7,5 +7,7 @@ X-Appwrite-Key: { "required": false, - "default": "" + "default": "", + "size": 0, + "newKey": } diff --git a/docs/examples/1.6.x/server-rest/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-rest/examples/databases/update-url-attribute.md index 9bb3f2bc9f..93802e2629 100644 --- a/docs/examples/1.6.x/server-rest/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-rest/examples/databases/update-url-attribute.md @@ -7,5 +7,6 @@ X-Appwrite-Key: { "required": false, - "default": "https://example.com" + "default": "https://example.com", + "newKey": } diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-boolean-attribute.md index b1b94a682b..854848617b 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-boolean-attribute.md @@ -14,5 +14,6 @@ result = databases.update_boolean_attribute( collection_id: '', key: '', required: false, - default: false + default: false, + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-datetime-attribute.md index df84731120..a7c8b32e9f 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-datetime-attribute.md @@ -14,5 +14,6 @@ result = databases.update_datetime_attribute( collection_id: '', key: '', required: false, - default: '' + default: '', + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-email-attribute.md index d72bc6bc88..9845f4bf4d 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-email-attribute.md @@ -14,5 +14,6 @@ result = databases.update_email_attribute( collection_id: '', key: '', required: false, - default: 'email@example.com' + default: 'email@example.com', + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-enum-attribute.md index 1e2a85d73d..6bc28c3759 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-enum-attribute.md @@ -15,5 +15,6 @@ result = databases.update_enum_attribute( key: '', elements: [], required: false, - default: '' + default: '', + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-float-attribute.md index 2c41ca1d22..4116d49e97 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-float-attribute.md @@ -16,5 +16,6 @@ result = databases.update_float_attribute( required: false, min: null, max: null, - default: null + default: null, + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-integer-attribute.md index 8e2b32a4f4..7bb8a19b76 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-integer-attribute.md @@ -16,5 +16,6 @@ result = databases.update_integer_attribute( required: false, min: null, max: null, - default: null + default: null, + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-ip-attribute.md index 517a5f4015..b53719edd8 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-ip-attribute.md @@ -14,5 +14,6 @@ result = databases.update_ip_attribute( collection_id: '', key: '', required: false, - default: '' + default: '', + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-relationship-attribute.md index b6126b5870..2b9d72a93a 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-relationship-attribute.md @@ -13,5 +13,6 @@ result = databases.update_relationship_attribute( database_id: '', collection_id: '', key: '', - on_delete: RelationMutate::CASCADE # optional + on_delete: RelationMutate::CASCADE, # optional + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-string-attribute.md index 17ab3e9a99..3b3c5eb644 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-string-attribute.md @@ -14,5 +14,7 @@ result = databases.update_string_attribute( collection_id: '', key: '', required: false, - default: '' + default: '', + size: null, # optional + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-ruby/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-ruby/examples/databases/update-url-attribute.md index 0e421d28f6..4367107e95 100644 --- a/docs/examples/1.6.x/server-ruby/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-ruby/examples/databases/update-url-attribute.md @@ -14,5 +14,6 @@ result = databases.update_url_attribute( collection_id: '', key: '', required: false, - default: 'https://example.com' + default: 'https://example.com', + new_key: '' # optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-boolean-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-boolean-attribute.md index c22cccd4d4..e40da1a1e1 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-boolean-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-boolean-attribute.md @@ -12,6 +12,7 @@ let attributeBoolean = try await databases.updateBooleanAttribute( collectionId: "", key: "", required: false, - default: false + default: false, + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-datetime-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-datetime-attribute.md index fafcf40390..a7728d24c5 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-datetime-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-datetime-attribute.md @@ -12,6 +12,7 @@ let attributeDatetime = try await databases.updateDatetimeAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-email-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-email-attribute.md index 8a5c3ce2be..137ca78afe 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-email-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-email-attribute.md @@ -12,6 +12,7 @@ let attributeEmail = try await databases.updateEmailAttribute( collectionId: "", key: "", required: false, - default: "email@example.com" + default: "email@example.com", + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-enum-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-enum-attribute.md index 1c43d84b01..bf7df6f714 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-enum-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-enum-attribute.md @@ -13,6 +13,7 @@ let attributeEnum = try await databases.updateEnumAttribute( key: "", elements: [], required: false, - default: "" + default: "", + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-float-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-float-attribute.md index d869c818bb..54a6065bcd 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-float-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-float-attribute.md @@ -14,6 +14,7 @@ let attributeFloat = try await databases.updateFloatAttribute( required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-integer-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-integer-attribute.md index 08391b6506..0a8d545ec9 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-integer-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-integer-attribute.md @@ -14,6 +14,7 @@ let attributeInteger = try await databases.updateIntegerAttribute( required: false, min: 0, max: 0, - default: 0 + default: 0, + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-ip-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-ip-attribute.md index 69eb79961a..2b4109665a 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-ip-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-ip-attribute.md @@ -12,6 +12,7 @@ let attributeIp = try await databases.updateIpAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-relationship-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-relationship-attribute.md index 31bd76de8b..8faa5ae17f 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-relationship-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-relationship-attribute.md @@ -12,6 +12,7 @@ let attributeRelationship = try await databases.updateRelationshipAttribute( databaseId: "", collectionId: "", key: "", - onDelete: .cascade // optional + onDelete: .cascade, // optional + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-string-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-string-attribute.md index a7fb46f32a..5fafd5e72e 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-string-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-string-attribute.md @@ -12,6 +12,8 @@ let attributeString = try await databases.updateStringAttribute( collectionId: "", key: "", required: false, - default: "" + default: "", + size: 0, // optional + newKey: "" // optional ) diff --git a/docs/examples/1.6.x/server-swift/examples/databases/update-url-attribute.md b/docs/examples/1.6.x/server-swift/examples/databases/update-url-attribute.md index d008c93312..b442a6add4 100644 --- a/docs/examples/1.6.x/server-swift/examples/databases/update-url-attribute.md +++ b/docs/examples/1.6.x/server-swift/examples/databases/update-url-attribute.md @@ -12,6 +12,7 @@ let attributeUrl = try await databases.updateUrlAttribute( collectionId: "", key: "", required: false, - default: "https://example.com" + default: "https://example.com", + newKey: "" // optional ) diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index e0cf8058c9..d25332126c 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -200,6 +200,7 @@ class Exception extends \Exception public const ATTRIBUTE_LIMIT_EXCEEDED = 'attribute_limit_exceeded'; public const ATTRIBUTE_VALUE_INVALID = 'attribute_value_invalid'; public const ATTRIBUTE_TYPE_INVALID = 'attribute_type_invalid'; + public const ATTRIBUTE_INVALID_RESIZE = 'attribute_invalid_resize'; /** Relationship */ public const RELATIONSHIP_VALUE_INVALID = 'relationship_value_invalid'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 3b1fc3d591..f8d1477494 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -89,7 +89,7 @@ abstract class Migration '1.5.8' => 'V20', '1.5.9' => 'V20', '1.5.10' => 'V20', - '1.6.0' => 'V21' + '1.6.0' => 'V21', ]; /** diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 4e9aee6b8a..65d2f7717c 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -252,9 +252,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND $gitUrl = $language['gitUrl']; $gitBranch = $language['gitBranch']; - // TEMPORARY - $gitBranch = '1.6.x'; - if (!$production) { $gitUrl = 'git@github.com:aw-tests/' . $language['gitRepoName'] . '.git'; } diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index be0abc4b66..e013220aa4 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -74,6 +74,7 @@ abstract class ScheduleBase extends Action ); return [ + '$internalId' => $schedule->getInternalId(), '$id' => $schedule->getId(), 'resourceId' => $schedule->getAttribute('resourceId'), 'schedule' => $schedule->getAttribute('schedule'), @@ -110,7 +111,7 @@ abstract class ScheduleBase extends Action foreach ($results as $document) { try { - $this->schedules[$document['resourceId']] = $getSchedule($document); + $this->schedules[$document->getInternalId()] = $getSchedule($document); } catch (\Throwable $th) { $collectionId = match ($document->getAttribute('resourceType')) { 'function' => 'functions', @@ -172,10 +173,10 @@ abstract class ScheduleBase extends Action if (!$document['active']) { Console::info("Removing: {$document['resourceId']}"); - unset($this->schedules[$document['resourceId']]); + unset($this->schedules[$document->getInternalId()]); } elseif ($new !== $org) { Console::info("Updating: {$document['resourceId']}"); - $this->schedules[$document['resourceId']] = $getSchedule($document); + $this->schedules[$document->getInternalId()] = $getSchedule($document); } } diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index c5f9b40d15..0e618642d5 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -36,7 +36,7 @@ class ScheduleExecutions extends ScheduleBase $schedule['$id'], ); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); continue; } @@ -70,7 +70,7 @@ class ScheduleExecutions extends ScheduleBase $schedule['$id'], ); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); } $queue->reclaim(); diff --git a/src/Appwrite/Platform/Tasks/ScheduleMessages.php b/src/Appwrite/Platform/Tasks/ScheduleMessages.php index 145b6ee976..167f1282ed 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleMessages.php +++ b/src/Appwrite/Platform/Tasks/ScheduleMessages.php @@ -53,7 +53,7 @@ class ScheduleMessages extends ScheduleBase $queue->reclaim(); - unset($this->schedules[$schedule['resourceId']]); + unset($this->schedules[$schedule['$internalId']]); }); } } diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php index 2b8acf8177..dc81ab76a7 100644 --- a/src/Appwrite/Platform/Workers/Builds.php +++ b/src/Appwrite/Platform/Workers/Builds.php @@ -411,7 +411,9 @@ class Builds extends Action Console::execute('rm -rf ' . \escapeshellarg($tmpPath), '', $stdout, $stderr); $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source)); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttribute('path', $source)); + + $directorySize = $deviceForFunctions->getFileSize($source); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttribute('path', $source)->setAttribute('size', $directorySize)); $this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForConsole); } diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index 0f0d298e3b..271bbfedf1 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -452,10 +452,10 @@ class Messaging extends Action $countryCode = $adapter->getCountryCode($message['to'][0] ?? ''); if (!empty($countryCode)) { $queueForUsage - ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_MESSAGES_COUNTRY_CODE), 1); + ->addMetric(str_replace('{countryCode}', $countryCode, METRIC_AUTH_METHOD_PHONE_COUNTRY_CODE), 1); } $queueForUsage - ->addMetric(METRIC_MESSAGES, 1) + ->addMetric(METRIC_AUTH_METHOD_PHONE, 1) ->setProject($project) ->trigger(); } catch (\Throwable $th) { diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index 085d3ca01b..7cb8adb815 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -640,7 +640,7 @@ class DatabasesCustomServerTest extends Scope } /** - * @depends testListCollections + * @depends testListCollections */ public function testCreateEncryptedAttribute(array $data): void { @@ -866,7 +866,7 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals($collection['body']['indexes'][0]['key'], $index['body']['key']); // Delete attribute - $attribute = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $actors ['body']['$id'] . '/attributes/' . $unneededId, array_merge([ + $attribute = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $actors['body']['$id'] . '/attributes/' . $unneededId, array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] @@ -1646,7 +1646,6 @@ class DatabasesCustomServerTest extends Scope ]; } - /** * @depends testAttributeUpdate */ @@ -3242,6 +3241,189 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(AppwriteException::ATTRIBUTE_DEFAULT_UNSUPPORTED, $update['body']['type']); } + /** + * @depends testAttributeUpdate + */ + public function testAttributeUpdateStringResize(array $data) + { + $key = 'string'; + $databaseId = $data['databaseId']; + $collectionId = $data['collectionId']; + + $document = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => 'string' + ], + "permissions" => ["read(\"any\")"] + ] + ); + + // Test Resize Up + $attribute = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string/' . $key, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'size' => 2048, + 'default' => '', + 'required' => false + ]); + + $this->assertEquals(200, $attribute['headers']['status-code']); + $this->assertEquals(2048, $attribute['body']['size']); + + // Test create new document with new size + $newDoc = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => str_repeat('a', 2048) + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(201, $newDoc['headers']['status-code']); + $this->assertEquals(2048, strlen($newDoc['body']['string'])); + + // Test update document with new size + $document = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $document['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'data' => [ + 'string' => str_repeat('a', 2048) + ] + ]); + + $this->assertEquals(200, $document['headers']['status-code']); + $this->assertEquals(2048, strlen($document['body']['string'])); + + // Test Exception on resize down with data that is too large + $attribute = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string/' . $key, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'size' => 10, + 'default' => '', + 'required' => false + ]); + + $this->assertEquals(400, $attribute['headers']['status-code']); + $this->assertEquals(AppwriteException::ATTRIBUTE_INVALID_RESIZE, $attribute['body']['type']); + + // original documents to original size, remove new document + $document = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $document['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'data' => [ + 'string' => 'string' + ] + ]); + + $this->assertEquals(200, $document['headers']['status-code']); + $this->assertEquals('string', $document['body']['string']); + + $deleteDoc = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $newDoc['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertEquals(204, $deleteDoc['headers']['status-code']); + + + // Test Resize Down + $attribute = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string/' . $key, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'size' => 10, + 'default' => '', + 'required' => false + ]); + + $this->assertEquals(200, $attribute['headers']['status-code']); + $this->assertEquals(10, $attribute['body']['size']); + + // Test create new document with new size + $newDoc = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => str_repeat('a', 10) + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(201, $newDoc['headers']['status-code']); + $this->assertEquals(10, strlen($newDoc['body']['string'])); + + // Test update document with new size + $document = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $document['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'data' => [ + 'string' => str_repeat('a', 10) + ] + ]); + + $this->assertEquals(200, $document['headers']['status-code']); + $this->assertEquals(10, strlen($document['body']['string'])); + + // Try create document with string that is too large + $newDoc = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => str_repeat('a', 11) + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(400, $newDoc['headers']['status-code']); + $this->assertEquals(AppwriteException::DOCUMENT_INVALID_STRUCTURE, $newDoc['body']['type']); + } + /** * @depends testAttributeUpdate */ @@ -3328,4 +3510,608 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(AppwriteException::ATTRIBUTE_NOT_FOUND, $update['body']['type']); } } + + /** + * @depends testAttributeUpdate + */ + public function testAttributeRename(array $data) + { + $key = 'string'; + $databaseId = $data['databaseId']; + $collectionId = $data['collectionId']; + + // Create document to test against + $document = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => 'string' + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(201, $document['headers']['status-code']); + + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string/' . $key, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'required' => false, + 'default' => 'lorum', + 'newKey' => 'new_string', + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + + $key = 'new_string'; + + $new = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/' . $key, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertEquals('new_string', $new['body']['key']); + + $doc1 = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $document['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('new_string', $doc1['body']); + $this->assertEquals('string', $doc1['body']['new_string']); + $this->assertArrayNotHasKey('string', $doc1['body']); + + // Try and create a new document with the new attribute + $doc2 = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'new_string' => 'string' + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(201, $doc2['headers']['status-code']); + $this->assertArrayHasKey('new_string', $doc2['body']); + $this->assertEquals('string', $doc2['body']['new_string']); + + // Expect fail, try and create a new document with the old attribute + $doc3 = $this->client->call( + Client::METHOD_POST, + '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), + [ + 'documentId' => 'unique()', + 'data' => [ + 'string' => 'string' + ], + "permissions" => ["read(\"any\")"] + ] + ); + + $this->assertEquals(400, $doc3['headers']['status-code']); + } + + public function createRelationshipCollections() + { + // Prepare the database with collections and relationships + $database = $this->client->call(Client::METHOD_POST, '/databases', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ], [ + 'databaseId' => 'database1', + 'name' => 'Test Database' + ]); + + $databaseId = $database['body']['$id']; + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => 'collection1', + 'name' => 'level1', + 'documentSecurity' => false, + 'permissions' => [ + Permission::create(Role::user($this->getUser()['$id'])), + Permission::read(Role::user($this->getUser()['$id'])), + Permission::update(Role::user($this->getUser()['$id'])), + Permission::delete(Role::user($this->getUser()['$id'])), + ] + ]); + + $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'collectionId' => 'collection2', + 'name' => 'level2', + 'documentSecurity' => false, + 'permissions' => [ + Permission::create(Role::user($this->getUser()['$id'])), + Permission::read(Role::user($this->getUser()['$id'])), + Permission::update(Role::user($this->getUser()['$id'])), + Permission::delete(Role::user($this->getUser()['$id'])), + ] + ]); + + \sleep(2); + } + + public function cleanupRelationshipCollection() + { + $this->client->call(Client::METHOD_DELETE, '/databases/database1', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + \sleep(2); + } + + public function testAttributeRenameRelationshipOneToMany() + { + $databaseId = 'database1'; + $collection1Id = 'collection1'; + $collection2Id = 'collection2'; + + $this->createRelationshipCollections(); + + $relation = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'relatedCollectionId' => $collection2Id, + 'type' => 'oneToMany', + 'twoWay' => true, + 'onDelete' => 'cascade', + 'key' => 'level2', + 'twoWayKey' => 'level1' + ]); + + \sleep(3); + + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $collection1RelationAttribute = $collection1Attributes['body']['attributes'][0]; + + $this->assertEquals($relation['body']['side'], $collection1RelationAttribute['side']); + $this->assertEquals($relation['body']['twoWayKey'], $collection1RelationAttribute['twoWayKey']); + $this->assertEquals($relation['body']['relatedCollection'], $collection1RelationAttribute['relatedCollection']); + + // Create a document for checking later + $originalDocument = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'documentId' => 'unique()', + 'data' => [ + 'level2' => [[ + '$id' => 'unique()', + '$permissions' => ["read(\"any\")"] + ]], + ], + "permissions" => ["read(\"any\")"] + ]); + + $this->assertEquals(201, $originalDocument['headers']['status-code']); + + // Rename the attribute + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/level2' . '/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'newKey' => 'new_level_2' + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + + // Check the document's key has been renamed + $newDocument = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents/' . $originalDocument['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('new_level_2', $newDocument['body']); + $this->assertEquals(1, count($newDocument['body']['new_level_2'])); + $this->assertArrayNotHasKey('level2', $newDocument['body']); + + // Check level2 document has been renamed + $level2Document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id . '/documents/' . $newDocument['body']['new_level_2'][0]['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('level1', $level2Document['body']); + $this->assertNotEmpty($level2Document['body']['level1']); + + // Check if attribute was renamed on the parent's side + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection1Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection1Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection1Attributes['body']['attributes'][0]['key']); + + // Check if attribute was renamed on the child's side + $collection2Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection2Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection2Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection2Attributes['body']['attributes'][0]['twoWayKey']); + + $this->cleanupRelationshipCollection(); + } + + public function testAttributeRenameRelationshipOneToOne() + { + $databaseId = 'database1'; + $collection1Id = 'collection1'; + $collection2Id = 'collection2'; + + $this->createRelationshipCollections(); + + $relation = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'relatedCollectionId' => $collection2Id, + 'type' => 'oneToOne', + 'twoWay' => true, + 'onDelete' => 'cascade', + 'key' => 'level2', + 'twoWayKey' => 'level1' + ]); + + \sleep(3); + + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $collection1RelationAttribute = $collection1Attributes['body']['attributes'][0]; + + $this->assertEquals($relation['body']['side'], $collection1RelationAttribute['side']); + $this->assertEquals($relation['body']['twoWayKey'], $collection1RelationAttribute['twoWayKey']); + $this->assertEquals($relation['body']['relatedCollection'], $collection1RelationAttribute['relatedCollection']); + + // Create a document for checking later + $originalDocument = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'documentId' => 'unique()', + 'data' => [ + 'level2' => [ + '$id' => 'unique()', + '$permissions' => ["read(\"any\")"] + ], + ], + "permissions" => ["read(\"any\")"] + ]); + + $this->assertEquals(201, $originalDocument['headers']['status-code']); + + // Rename the attribute + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/level2' . '/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'newKey' => 'new_level_2' + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + + // Check the document's key has been renamed + $newDocument = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents/' . $originalDocument['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('new_level_2', $newDocument['body']); + $this->assertNotEmpty($newDocument['body']['new_level_2']); + $this->assertArrayNotHasKey('level2', $newDocument['body']); + + // Check level2 document has been renamed + $level2Document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id . '/documents/' . $newDocument['body']['new_level_2']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('level1', $level2Document['body']); + $this->assertNotEmpty($level2Document['body']['level1']); + + // Check if attribute was renamed on the parent's side + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection1Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection1Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection1Attributes['body']['attributes'][0]['key']); + + // Check if attribute was renamed on the child's side + $collection2Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection2Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection2Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection2Attributes['body']['attributes'][0]['twoWayKey']); + + $this->cleanupRelationshipCollection(); + } + + public function testAttributeRenameRelationshipManyToOne() + { + $databaseId = 'database1'; + $collection1Id = 'collection1'; + $collection2Id = 'collection2'; + + $this->createRelationshipCollections(); + + $relation = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'relatedCollectionId' => $collection2Id, + 'type' => 'manyToOne', + 'twoWay' => true, + 'onDelete' => 'cascade', + 'key' => 'level2', + 'twoWayKey' => 'level1' + ]); + + \sleep(3); + + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $collection1RelationAttribute = $collection1Attributes['body']['attributes'][0]; + + $this->assertEquals($relation['body']['side'], $collection1RelationAttribute['side']); + $this->assertEquals($relation['body']['twoWayKey'], $collection1RelationAttribute['twoWayKey']); + $this->assertEquals($relation['body']['relatedCollection'], $collection1RelationAttribute['relatedCollection']); + + // Create a document for checking later + $originalDocument = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'documentId' => 'unique()', + 'data' => [ + 'level2' => [ + '$id' => 'unique()', + '$permissions' => ["read(\"any\")"] + ], + ], + "permissions" => ["read(\"any\")"] + ]); + + $this->assertEquals(201, $originalDocument['headers']['status-code']); + + // Rename the attribute + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/level2' . '/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'newKey' => 'new_level_2' + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + + // Check the document's key has been renamed + $newDocument = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents/' . $originalDocument['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('new_level_2', $newDocument['body']); + $this->assertNotEmpty($newDocument['body']['new_level_2']); + $this->assertArrayNotHasKey('level2', $newDocument['body']); + + // Check level2 document has been renamed + $level2Document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id . '/documents/' . $newDocument['body']['new_level_2']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('level1', $level2Document['body']); + $this->assertNotEmpty($level2Document['body']['level1']); + + // Check if attribute was renamed on the parent's side + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection1Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection1Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection1Attributes['body']['attributes'][0]['key']); + + // Check if attribute was renamed on the child's side + $collection2Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection2Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection2Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection2Attributes['body']['attributes'][0]['twoWayKey']); + + $this->cleanupRelationshipCollection(); + } + + public function testAttributeRenameRelationshipManyToMany() + { + $databaseId = 'database1'; + $collection1Id = 'collection1'; + $collection2Id = 'collection2'; + + $this->createRelationshipCollections(); + + $relation = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'relatedCollectionId' => $collection2Id, + 'type' => 'manyToOne', + 'twoWay' => true, + 'onDelete' => 'cascade', + 'key' => 'level2', + 'twoWayKey' => 'level1' + ]); + + \sleep(3); + + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $collection1RelationAttribute = $collection1Attributes['body']['attributes'][0]; + + $this->assertEquals($relation['body']['side'], $collection1RelationAttribute['side']); + $this->assertEquals($relation['body']['twoWayKey'], $collection1RelationAttribute['twoWayKey']); + $this->assertEquals($relation['body']['relatedCollection'], $collection1RelationAttribute['relatedCollection']); + + // Create a document for checking later + $originalDocument = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'documentId' => 'unique()', + 'data' => [ + 'level2' => [ + '$id' => 'unique()', + '$permissions' => ["read(\"any\")"] + ], + ], + "permissions" => ["read(\"any\")"] + ]); + + $this->assertEquals(201, $originalDocument['headers']['status-code']); + + // Rename the attribute + $update = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/attributes/level2' . '/relationship', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'newKey' => 'new_level_2' + ]); + + $this->assertEquals(200, $update['headers']['status-code']); + + // Check the document's key has been renamed + $newDocument = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id . '/documents/' . $originalDocument['body']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('new_level_2', $newDocument['body']); + $this->assertNotEmpty($newDocument['body']['new_level_2']); + $this->assertArrayNotHasKey('level2', $newDocument['body']); + + // Check level2 document has been renamed + $level2Document = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id . '/documents/' . $newDocument['body']['new_level_2']['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $this->assertArrayHasKey('level1', $level2Document['body']); + $this->assertNotEmpty($level2Document['body']['level1']); + + // Check if attribute was renamed on the parent's side + $collection1Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection1Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection1Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection1Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection1Attributes['body']['attributes'][0]['key']); + + // Check if attribute was renamed on the child's side + $collection2Attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collection2Id, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + + $this->assertEquals(200, $collection2Attributes['headers']['status-code']); + $this->assertEquals(1, count($collection2Attributes['body']['attributes'])); + $this->assertEquals('new_level_2', $collection2Attributes['body']['attributes'][0]['twoWayKey']); + + $this->cleanupRelationshipCollection(); + } }