From d5d09061e9c7c9cae7c12eaaa15f5eccbebde3f3 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 9 Oct 2025 13:46:14 +1300 Subject: [PATCH] Fix index validator params --- composer.lock | 21 ++++++++++--------- .../Databases/Collections/Indexes/Create.php | 2 ++ .../Databases/Legacy/DatabasesBase.php | 10 +++++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 36eaa9b9bf..569330e51f 100644 --- a/composer.lock +++ b/composer.lock @@ -3791,12 +3791,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "b7d24b59fb7511097625e7ed91fb4b6db7aa0a65" + "reference": "2f60ed82ecb41b2a3d868a9090b7332bbd285e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/b7d24b59fb7511097625e7ed91fb4b6db7aa0a65", - "reference": "b7d24b59fb7511097625e7ed91fb4b6db7aa0a65", + "url": "https://api.github.com/repos/utopia-php/database/zipball/2f60ed82ecb41b2a3d868a9090b7332bbd285e8a", + "reference": "2f60ed82ecb41b2a3d868a9090b7332bbd285e8a", "shasum": "" }, "require": { @@ -3841,7 +3841,7 @@ "issues": "https://github.com/utopia-php/database/issues", "source": "https://github.com/utopia-php/database/tree/feat-mongodb" }, - "time": "2025-10-07T08:07:05+00:00" + "time": "2025-10-08T23:31:39+00:00" }, { "name": "utopia-php/detector", @@ -4781,16 +4781,16 @@ }, { "name": "utopia-php/storage", - "version": "0.18.13", + "version": "0.18.14", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "3d8ce53ae042173bf230445e996056c5f65ded22" + "reference": "4f14ec952c6f4006dd0613e55bbf7631814fbc00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/3d8ce53ae042173bf230445e996056c5f65ded22", - "reference": "3d8ce53ae042173bf230445e996056c5f65ded22", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/4f14ec952c6f4006dd0613e55bbf7631814fbc00", + "reference": "4f14ec952c6f4006dd0613e55bbf7631814fbc00", "shasum": "" }, "require": { @@ -4833,9 +4833,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.13" + "source": "https://github.com/utopia-php/storage/tree/0.18.14" }, - "time": "2025-05-26T13:10:35+00:00" + "time": "2025-10-07T10:21:47+00:00" }, { "name": "utopia-php/swoole", @@ -5342,6 +5342,7 @@ "issues": "https://github.com/doctrine/annotations/issues", "source": "https://github.com/doctrine/annotations/tree/2.0.2" }, + "abandoned": true, "time": "2024-09-05T10:17:24+00:00" }, { 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 2bc4569c6f..a1da978634 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 @@ -196,6 +196,7 @@ class Create extends Action $supportForSpatialAttributes = $dbForProject->getAdapter()->getSupportForSpatialAttributes(); $supportForSpatialIndexNull = $dbForProject->getAdapter()->getSupportForSpatialIndexNull(); $supportForSpatialIndexOrder = $dbForProject->getAdapter()->getSupportForSpatialIndexOrder(); + $supportForAttributes = $dbForProject->getAdapter()->getSupportForAttributes(); $supportForMultipleFulltextIndexes = $dbForProject->getAdapter()->getSupportForMultipleFulltextIndexes(); $supportForIdenticalIndexes = $dbForProject->getAdapter()->getSupportForIdenticalIndexes(); @@ -208,6 +209,7 @@ class Create extends Action $supportForSpatialAttributes, $supportForSpatialIndexNull, $supportForSpatialIndexOrder, + $supportForAttributes, $supportForMultipleFulltextIndexes, $supportForIdenticalIndexes ); diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index bdb184b9a4..40a52e3a8f 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -1502,7 +1502,14 @@ trait DatabasesBase $this->assertEquals([128, 200], $index['body']['lengths']); // Test case for lengths array overriding - // set a length for an array attribute, it should get overriden with Database::ARRAY_INDEX_LENGTH + // set a length for an array attribute, it should get overridden with Database::ARRAY_INDEX_LENGTH + // MongoDB doesn't support identical indexes, so delete the existing one first + $this->client->call(Client::METHOD_DELETE, "/databases/{$databaseId}/collections/{$collectionId}/indexes/index-actors", [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]); + $create = $this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$collectionId}/indexes", [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -1512,7 +1519,6 @@ trait DatabasesBase 'type' => 'key', 'attributes' => ['actors'], 'lengths' => [120], - 'orders' => [Database::ORDER_DESC], ]); $this->assertEquals(202, $create['headers']['status-code']);