From ffb3a522b005aeeecb50e13ef1b30e0bcf05fbfd Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 14:06:39 +0300 Subject: [PATCH 1/7] Check tests --- composer.json | 2 +- composer.lock | 16 ++++++++-------- .../Databases/Collections/Indexes/Create.php | 1 + .../Services/Databases/Legacy/DatabasesBase.php | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index d39cb697ae..1ebd6716e3 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.71.*", + "utopia-php/database": "0.72.*", "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 1ff4873f4d..1ab388d5a8 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": "ab1e70292d43534acfbab067f0341181", + "content-hash": "040a8234ecf1038a7e6dc16aa2dda084", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.10", + "version": "0.72.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636" + "reference": "276fffbf889a455fefd5f3dcda89f249a92fd5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/83278d663f9c63c25a11d9e71c7922da7ec48636", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636", + "url": "https://api.github.com/repos/utopia-php/database/zipball/276fffbf889a455fefd5f3dcda89f249a92fd5e2", + "reference": "276fffbf889a455fefd5f3dcda89f249a92fd5e2", "shasum": "" }, "require": { @@ -3543,9 +3543,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.71.10" + "source": "https://github.com/utopia-php/database/tree/0.72.0" }, - "time": "2025-07-18T00:05:55+00:00" + "time": "2025-07-21T03:45:49+00:00" }, { "name": "utopia-php/detector", @@ -8239,7 +8239,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "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 9003fbb4a9..7247d246ef 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 @@ -187,6 +187,7 @@ class Create extends Action $collection->getAttribute('attributes'), $dbForProject->getAdapter()->getMaxIndexLength(), $dbForProject->getAdapter()->getInternalIndexesKeys(), + $dbForProject->getAdapter()->getSupportForIndexArray() ); if (!$validator->isValid($index)) { diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 248bc3b12d..87116b5c60 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -438,7 +438,7 @@ trait DatabasesBase ]); $this->assertEquals(202, $attribute['headers']['status-code']); $this->assertEquals($attribute['body']['size'], 100); - +var_dump($attribute); sleep(1); $index = $this->client->call(Client::METHOD_POST, '/databases/'.$databaseId.'/collections/'.$collection['body']['$id'].'/indexes', array_merge([ @@ -453,7 +453,7 @@ trait DatabasesBase $this->assertEquals(202, $index['headers']['status-code']); sleep(1); - +var_dump($index); /** * Update attribute size to exceed Index maximum length */ @@ -466,7 +466,7 @@ trait DatabasesBase 'required' => true, 'default' => null, ]); - +var_dump($attribute); $this->assertEquals(400, $attribute['headers']['status-code']); $this->assertStringContainsString('Index length is longer than the maximum: 76', $attribute['body']['message']); } From 1ff1b5529882f4e191034a71d3535a0c3e4a642d Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 14:12:10 +0300 Subject: [PATCH 2/7] Check tests --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 87116b5c60..27b23a2eb4 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -454,6 +454,8 @@ var_dump($attribute); sleep(1); var_dump($index); + $this->assertEquals('shmuel', 'dsdsd'); + /** * Update attribute size to exceed Index maximum length */ From b2cd1413ce0a23039bacdc5579709d8031870684 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 17:45:34 +0300 Subject: [PATCH 3/7] 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 From 51f518ae03af18460334872250693286d7616581 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 18:11:13 +0300 Subject: [PATCH 4/7] Remove var_dump --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index d7aaada24f..644f6a130c 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -438,7 +438,7 @@ trait DatabasesBase ]); $this->assertEquals(202, $attribute['headers']['status-code']); $this->assertEquals($attribute['body']['size'], 100); -var_dump($attribute); + sleep(1); $index = $this->client->call(Client::METHOD_POST, '/databases/'.$databaseId.'/collections/'.$collection['body']['$id'].'/indexes', array_merge([ @@ -453,8 +453,6 @@ var_dump($attribute); $this->assertEquals(202, $index['headers']['status-code']); sleep(1); -var_dump($index); - //$this->assertEquals('shmuel', 'dsdsd'); /** * Update attribute size to exceed Index maximum length From 64d1d78d84e88b55ccc32af25fda1b1919a9385a Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 18:15:48 +0300 Subject: [PATCH 5/7] lock --- composer.lock | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 73baf27824..94d7921139 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": "25ac1acb960988af5c10239c3bde258b", + "content-hash": "9a018b6bf824147378fb0b5b51ed8b58", "packages": [ { "name": "adhocore/jwt", @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.10", + "version": "dev-fix-index-length", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636" + "reference": "b743f4a1408efdafe664b381c2b29763d4363fde" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/83278d663f9c63c25a11d9e71c7922da7ec48636", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636", + "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.71.10" + "source": "https://github.com/utopia-php/database/tree/fix-index-length" }, - "time": "2025-07-18T00:05:55+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": { From e82003873a981a660b6b396cae09464dd62e73a6 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 18:17:12 +0300 Subject: [PATCH 6/7] formatting --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 644f6a130c..77b6255bed 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -466,7 +466,7 @@ trait DatabasesBase 'required' => true, 'default' => null, ]); -var_dump($attribute); + var_dump($attribute); $this->assertEquals(400, $attribute['headers']['status-code']); $this->assertStringContainsString('Index length is longer than the maximum: 76', $attribute['body']['message']); } From ee5ce895f79cd88d9b1ecce8433cdd7783c3ccfb Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 18:26:53 +0300 Subject: [PATCH 7/7] Remove var_dump --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 77b6255bed..248bc3b12d 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -466,7 +466,7 @@ trait DatabasesBase 'required' => true, 'default' => null, ]); - var_dump($attribute); + $this->assertEquals(400, $attribute['headers']['status-code']); $this->assertStringContainsString('Index length is longer than the maximum: 76', $attribute['body']['message']); }