From ffb3a522b005aeeecb50e13ef1b30e0bcf05fbfd Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 21 Jul 2025 14:06:39 +0300 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 04/12] 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 05/12] 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 06/12] 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 07/12] 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']); } From 9a6032c80485a37f7a82471f1e8bb3fbb5f20c95 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Jul 2025 12:11:03 +1200 Subject: [PATCH 08/12] Update libs --- composer.json | 4 +- composer.lock | 38 +++++++++---------- .../Databases/Collections/Indexes/Create.php | 1 + 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 2065139bb9..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", @@ -62,7 +62,7 @@ "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.18.*", - "utopia-php/migration": "0.12.*", + "utopia-php/migration": "0.13.*", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.8.*", diff --git a/composer.lock b/composer.lock index 73baf27824..102f61937c 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": "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", @@ -3942,16 +3942,16 @@ }, { "name": "utopia-php/messaging", - "version": "0.18.1", + "version": "0.18.2", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f" + "reference": "0d364edacf4d4867964c7e17f653031dd39394bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/5d1245207a61d7ca065daddad7ac5f1d5640152f", - "reference": "5d1245207a61d7ca065daddad7ac5f1d5640152f", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/0d364edacf4d4867964c7e17f653031dd39394bf", + "reference": "0d364edacf4d4867964c7e17f653031dd39394bf", "shasum": "" }, "require": { @@ -3987,22 +3987,22 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/0.18.1" + "source": "https://github.com/utopia-php/messaging/tree/0.18.2" }, - "time": "2025-06-26T18:26:07+00:00" + "time": "2025-07-21T18:27:03+00:00" }, { "name": "utopia-php/migration", - "version": "0.12.0", + "version": "0.13.1", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0" + "reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/973a4daa283f711a104e9bb7cf5a79dec2988df0", - "reference": "973a4daa283f711a104e9bb7cf5a79dec2988df0", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc", + "reference": "b3c51e39f35efeb15431c6bc8f5bc6cf78fac9cc", "shasum": "" }, "require": { @@ -4043,9 +4043,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.12.0" + "source": "https://github.com/utopia-php/migration/tree/0.13.1" }, - "time": "2025-07-17T12:20:11+00:00" + "time": "2025-07-21T23:22:05+00:00" }, { "name": "utopia-php/orchestration", 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)) { From f33ed64f6aac045b83a33b6698fa4233ca957615 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Jul 2025 14:14:08 +1200 Subject: [PATCH 09/12] Fix index tests --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 8 ++++---- tests/e2e/Services/Databases/Tables/DatabasesBase.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 248bc3b12d..c44be93b56 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -1344,7 +1344,8 @@ trait DatabasesBase 'attributes' => ['actors'], ]); - $this->assertEquals(202, $actorsArray['headers']['status-code']); + // Indexes on array attributes are disabled due to MySQL bug + $this->assertEquals(400, $actorsArray['headers']['status-code']); $twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', @@ -1357,9 +1358,8 @@ trait DatabasesBase 'orders' => ['DESC', 'DESC'], ]); - $this->assertEquals(202, $twoLevelsArray['headers']['status-code']); - $this->assertEquals('DESC', $twoLevelsArray['body']['orders'][0]); - $this->assertEquals(null, $twoLevelsArray['body']['orders'][1]); // Overwrite by API (array) + // Indexes on array attributes are disabled due to MySQL bug + $this->assertEquals(400, $twoLevelsArray['headers']['status-code']); $unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', diff --git a/tests/e2e/Services/Databases/Tables/DatabasesBase.php b/tests/e2e/Services/Databases/Tables/DatabasesBase.php index 7804fd0ec2..19f5cc0d8c 100644 --- a/tests/e2e/Services/Databases/Tables/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Tables/DatabasesBase.php @@ -1344,7 +1344,8 @@ trait DatabasesBase 'columns' => ['actors'], ]); - $this->assertEquals(202, $actorsArray['headers']['status-code']); + // Indexes on array attributes are disabled due to MySQL bug + $this->assertEquals(400, $actorsArray['headers']['status-code']); $twoLevelsArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', @@ -1357,9 +1358,8 @@ trait DatabasesBase 'orders' => ['DESC', 'DESC'], ]); - $this->assertEquals(202, $twoLevelsArray['headers']['status-code']); - $this->assertEquals('DESC', $twoLevelsArray['body']['orders'][0]); - $this->assertEquals(null, $twoLevelsArray['body']['orders'][1]); // Overwrite by API (array) + // Indexes on array attributes are disabled due to MySQL bug + $this->assertEquals(400, $twoLevelsArray['headers']['status-code']); $unknown = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', From afd6730a81028836ea4231abd38a7906bde7321b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Jul 2025 14:43:32 +1200 Subject: [PATCH 10/12] FIx name mismatch --- app/controllers/api/projects.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 34ed85a418..92356526bd 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -2523,7 +2523,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation') ->param('enabled', false, new Boolean(), 'Update authentication session invalidation status. Use this endpoint to enable or disable session invalidation on password change') ->inject('response') ->inject('dbForPlatform') - ->action(function (string $projectId, bool $invalidateSessions, Response $response, Database $dbForPlatform) { + ->action(function (string $projectId, bool $enabled, Response $response, Database $dbForPlatform) { $project = $dbForPlatform->getDocument('projects', $projectId); @@ -2532,7 +2532,7 @@ App::patch('/v1/projects/:projectId/auth/session-invalidation') } $auths = $project->getAttribute('auths', []); - $auths['invalidateSessions'] = $invalidateSessions; + $auths['invalidateSessions'] = $enabled; $dbForPlatform->updateDocument('projects', $project->getId(), $project ->setAttribute('auths', $auths)); From 724ee41eff65430b0db92972c46814227974e65a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Jul 2025 14:48:48 +1200 Subject: [PATCH 11/12] Fix index tests --- tests/e2e/Services/Databases/Legacy/DatabasesBase.php | 6 +++--- tests/e2e/Services/Databases/Tables/DatabasesBase.php | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index c44be93b56..26111fcab9 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -1385,7 +1385,7 @@ trait DatabasesBase 'orders' => ['DESC'], // Check order is removed in API ]); - // Array attributes can not be indexed due to MySQL bug + // Indexes on array attributes are disabled due to MySQL bug $this->assertEquals(400, $index1['headers']['status-code']); $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ @@ -1398,7 +1398,7 @@ trait DatabasesBase 'attributes' => ['integers'], // array attribute ]); - // Array attributes can not be indexed due to MySQL bug + // Indexes on array attributes are disabled due to MySQL bug $this->assertEquals(400, $index2['headers']['status-code']); /** @@ -1413,7 +1413,7 @@ trait DatabasesBase ]), []); $this->assertIsArray($movies['body']['indexes']); - $this->assertCount(8, $movies['body']['indexes']); + $this->assertCount(4, $movies['body']['indexes']); $this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']); $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); diff --git a/tests/e2e/Services/Databases/Tables/DatabasesBase.php b/tests/e2e/Services/Databases/Tables/DatabasesBase.php index 19f5cc0d8c..89148627a2 100644 --- a/tests/e2e/Services/Databases/Tables/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Tables/DatabasesBase.php @@ -1384,6 +1384,8 @@ trait DatabasesBase 'columns' => ['integers'], // array attribute 'orders' => ['DESC'], // Check order is removed in API ]); + + // Indexes on array attributes are disabled due to MySQL bug $this->assertEquals(400, $index1['headers']['status-code']); $index2 = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([ @@ -1395,6 +1397,8 @@ trait DatabasesBase 'type' => 'key', 'columns' => ['integers'], // array attribute ]); + + // Indexes on array attributes are disabled due to MySQL bug $this->assertEquals(400, $index2['headers']['status-code']); /** @@ -1409,7 +1413,7 @@ trait DatabasesBase ]), []); $this->assertIsArray($movies['body']['indexes']); - $this->assertCount(8, $movies['body']['indexes']); + $this->assertCount(4, $movies['body']['indexes']); $this->assertEquals($titleIndex['body']['key'], $movies['body']['indexes'][0]['key']); $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); From 8056a9d675b54460ad1f2d303b0b35d9fb0b66da Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 22 Jul 2025 15:47:38 +1200 Subject: [PATCH 12/12] Update database --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 3de63bc90b..278f6a1dfe 100644 --- a/composer.lock +++ b/composer.lock @@ -3493,16 +3493,16 @@ }, { "name": "utopia-php/database", - "version": "0.72.1", + "version": "0.72.2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "239b19b5374a08ba62ecefbbc765a5c8d744c851" + "reference": "ad7613ac19bb799fc911cf82636a09345b2573fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/239b19b5374a08ba62ecefbbc765a5c8d744c851", - "reference": "239b19b5374a08ba62ecefbbc765a5c8d744c851", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ad7613ac19bb799fc911cf82636a09345b2573fe", + "reference": "ad7613ac19bb799fc911cf82636a09345b2573fe", "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.1" + "source": "https://github.com/utopia-php/database/tree/0.72.2" }, - "time": "2025-07-22T01:39:17+00:00" + "time": "2025-07-22T03:13:31+00:00" }, { "name": "utopia-php/detector",