From b2cd1413ce0a23039bacdc5579709d8031870684 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 17:45:34 +0300 Subject: [PATCH] Fallback index length 0 --- composer.json | 2 +- composer.lock | 27 ++++++++++++------- .../Databases/Collections/Indexes/Create.php | 4 ++- .../Databases/Legacy/DatabasesBase.php | 2 +- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 1ebd6716e3..929a0acfaf 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.72.*", + "utopia-php/database": "dev-fix-index-length as 0.72.10", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dsn": "0.2.1", diff --git a/composer.lock b/composer.lock index 1ab388d5a8..8ebb9c7539 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": "040a8234ecf1038a7e6dc16aa2dda084", + "content-hash": "b855431b456629b5ecebe208bdd4b403", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.72.0", + "version": "dev-fix-index-length", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "276fffbf889a455fefd5f3dcda89f249a92fd5e2" + "reference": "b743f4a1408efdafe664b381c2b29763d4363fde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/276fffbf889a455fefd5f3dcda89f249a92fd5e2", - "reference": "276fffbf889a455fefd5f3dcda89f249a92fd5e2", + "url": "https://api.github.com/repos/utopia-php/database/zipball/b743f4a1408efdafe664b381c2b29763d4363fde", + "reference": "b743f4a1408efdafe664b381c2b29763d4363fde", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.72.0" + "source": "https://github.com/utopia-php/database/tree/fix-index-length" }, - "time": "2025-07-21T03:45:49+00:00" + "time": "2025-07-21T12:57:09+00:00" }, { "name": "utopia-php/detector", @@ -8237,9 +8237,18 @@ "time": "2024-03-07T20:33:40+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-fix-index-length", + "alias": "0.72.10", + "alias_normalized": "0.72.10.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index 7247d246ef..199ace5180 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -161,7 +161,9 @@ class Create extends Action throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']); } - $lengths[$i] ??= null; + if (empty($lengths[$i])) { + $lengths[$i] = null; + } if ($attributeArray === true) { $lengths[$i] = Database::ARRAY_INDEX_LENGTH; diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 27b23a2eb4..d7aaada24f 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -454,7 +454,7 @@ var_dump($attribute); sleep(1); var_dump($index); - $this->assertEquals('shmuel', 'dsdsd'); + //$this->assertEquals('shmuel', 'dsdsd'); /** * Update attribute size to exceed Index maximum length