diff --git a/composer.json b/composer.json index d810145c69..d19a0a9375 100644 --- a/composer.json +++ b/composer.json @@ -54,7 +54,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "dev-feat-mongo-tmp as 1.4.8", + "utopia-php/database": "dev-feat-mongo-index-validation as 1.4.8", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dns": "0.3.*", @@ -62,7 +62,7 @@ "utopia-php/framework": "0.33.*", "utopia-php/fetch": "0.4.*", "utopia-php/image": "0.8.*", - "utopia-php/locale": "0.4.*", + "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.18.*", "utopia-php/migration": "1.1.*", diff --git a/composer.lock b/composer.lock index 7acac80117..9aaf7fa2e6 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": "4160a9b6401e9e5492cf374d37b70e72", + "content-hash": "ed88ad4891875ba9bc77aff8557765fc", "packages": [ { "name": "adhocore/jwt", @@ -3787,16 +3787,16 @@ }, { "name": "utopia-php/database", - "version": "dev-feat-mongo-tmp", + "version": "dev-feat-mongo-index-validation", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "873f2aef52ae028c1cc94a5901b1d6ee06df86ff" + "reference": "bb769113efa9250e27e17c7681d86c40c79db0b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/873f2aef52ae028c1cc94a5901b1d6ee06df86ff", - "reference": "873f2aef52ae028c1cc94a5901b1d6ee06df86ff", + "url": "https://api.github.com/repos/utopia-php/database/zipball/bb769113efa9250e27e17c7681d86c40c79db0b1", + "reference": "bb769113efa9250e27e17c7681d86c40c79db0b1", "shasum": "" }, "require": { @@ -3838,9 +3838,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/feat-mongo-tmp" + "source": "https://github.com/utopia-php/database/tree/feat-mongo-index-validation" }, - "time": "2025-09-19T02:18:11+00:00" + "time": "2025-09-21T14:14:06+00:00" }, { "name": "utopia-php/detector", @@ -4188,22 +4188,24 @@ }, { "name": "utopia-php/locale", - "version": "0.4.0", + "version": "0.8.0", "source": { "type": "git", "url": "https://github.com/utopia-php/locale.git", - "reference": "c2d9358d0fe2f6b6ed5448369f9d1e430c615447" + "reference": "10ffc869c904c45e32ab0c61f4b33ba774777eb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/locale/zipball/c2d9358d0fe2f6b6ed5448369f9d1e430c615447", - "reference": "c2d9358d0fe2f6b6ed5448369f9d1e430c615447", + "url": "https://api.github.com/repos/utopia-php/locale/zipball/10ffc869c904c45e32ab0c61f4b33ba774777eb6", + "reference": "10ffc869c904c45e32ab0c61f4b33ba774777eb6", "shasum": "" }, "require": { "php": ">=7.4" }, "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.*", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1" }, @@ -4217,12 +4219,6 @@ "license": [ "MIT" ], - "authors": [ - { - "name": "Eldad Fux", - "email": "eldad@appwrite.io" - } - ], "description": "A simple locale library to manage application translations", "keywords": [ "framework", @@ -4233,9 +4229,9 @@ ], "support": { "issues": "https://github.com/utopia-php/locale/issues", - "source": "https://github.com/utopia-php/locale/tree/0.4.0" + "source": "https://github.com/utopia-php/locale/tree/0.8.0" }, - "time": "2021-07-24T11:35:55+00:00" + "time": "2025-08-12T12:58:26+00:00" }, { "name": "utopia-php/logger", @@ -8725,7 +8721,7 @@ "aliases": [ { "package": "utopia-php/database", - "version": "dev-feat-mongo-tmp", + "version": "dev-feat-mongo-index-validation", "alias": "1.4.8", "alias_normalized": "1.4.8.0" } 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 733259f091..81f72f4f7a 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,15 +196,20 @@ class Create extends Action $supportForSpatialAttributes = $dbForProject->getAdapter()->getSupportForSpatialAttributes(); $supportForSpatialIndexNull = $dbForProject->getAdapter()->getSupportForSpatialIndexNull(); $supportForSpatialIndexOrder = $dbForProject->getAdapter()->getSupportForSpatialIndexOrder(); + $supportForMultipleFulltextIndexes = $dbForProject->getAdapter()->getSupportForMultipleFulltextIndexes(); + $supportForIdenticalIndexes = $dbForProject->getAdapter()->getSupportForIdenticalIndexes(); $validator = new IndexValidator( $collection->getAttribute('attributes'), + $collection->getAttribute('indexes'), $maxIndexLength, $internalIndexesKeys, $supportForIndexArray, $supportForSpatialAttributes, $supportForSpatialIndexNull, - $supportForSpatialIndexOrder + $supportForSpatialIndexOrder, + $supportForMultipleFulltextIndexes, + $supportForIdenticalIndexes ); if (!$validator->isValid($index)) { diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index 8431a9d919..77fbdcaaf3 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -1499,10 +1499,12 @@ trait DatabasesBase 'key' => 'lengthOverrideTestIndex', 'type' => 'key', 'attributes' => ['actors'], - 'lengths' => [120] + 'lengths' => [120], + 'orders' => [Database::ORDER_DESC], ]); - $this->assertEquals(202, $create['headers']['status-code']); + $this->assertEquals(202, $create['headers']['status-code']); + $index = $this->client->call(Client::METHOD_GET, "/databases/{$databaseId}/collections/{$collectionId}/indexes/lengthOverrideTestIndex", [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -4232,6 +4234,7 @@ trait DatabasesBase public function testUniqueIndexDuplicate(array $data): array { $databaseId = $data['databaseId']; + $uniqueIndex = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -4240,10 +4243,11 @@ trait DatabasesBase 'key' => 'unique_title', 'type' => 'unique', 'attributes' => ['title'], + 'orders' => [Database::ORDER_DESC], ]); - - $this->assertEquals(202, $uniqueIndex['headers']['status-code']); - + + $this->assertEquals(202, $uniqueIndex['headers']['status-code']); + sleep(2); // test for failure @@ -8022,7 +8026,7 @@ trait DatabasesBase public function testSpatialColCreateOnExistingDataWithDefaults(): void { - + if ($this->isMongoDB()) { $this->markTestSkipped('MongoDB is not supported for this test'); }