Merge pull request #10664 from appwrite/feat-update-db

Update db
This commit is contained in:
Jake Barnby 2025-10-20 14:11:36 +00:00 committed by GitHub
commit e2d3624713
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 278 additions and 61 deletions

View file

@ -53,7 +53,7 @@
"utopia-php/cache": "0.13.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "2.*",
"utopia-php/database": "3.*",
"utopia-php/detector": "0.1.*",
"utopia-php/domains": "0.8.*",
"utopia-php/dns": "0.3.*",

302
composer.lock generated
View file

@ -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": "9658991ad6520dad5807d7e1ed1e9bd4",
"content-hash": "3e8df036b4cb47d2eae34be382e04800",
"packages": [
{
"name": "adhocore/jwt",
@ -959,6 +959,83 @@
},
"time": "2025-08-20T17:20:16+00:00"
},
{
"name": "mongodb/mongodb",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "f399d24905dd42f97dfe0af9706129743ef247ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/f399d24905dd42f97dfe0af9706129743ef247ac",
"reference": "f399d24905dd42f97dfe0af9706129743ef247ac",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0",
"ext-mongodb": "^2.1",
"php": "^8.1",
"psr/log": "^1.1.4|^2|^3",
"symfony/polyfill-php85": "^1.32"
},
"replace": {
"mongodb/builder": "*"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpunit/phpunit": "^10.5.35",
"rector/rector": "^1.2",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "6.5.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"MongoDB\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Andreas Braun",
"email": "andreas.braun@mongodb.com"
},
{
"name": "Jeremy Mikola",
"email": "jmikola@gmail.com"
},
{
"name": "Jérôme Tamarelle",
"email": "jerome.tamarelle@mongodb.com"
}
],
"description": "MongoDB driver library",
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
"keywords": [
"database",
"driver",
"mongodb",
"persistence"
],
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/2.1.1"
},
"time": "2025-08-13T20:50:05+00:00"
},
{
"name": "mustangostang/spyc",
"version": "0.6.3",
@ -3017,6 +3094,86 @@
],
"time": "2025-07-08T02:45:35+00:00"
},
{
"name": "symfony/polyfill-php85",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php85.git",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"shasum": ""
},
"require": {
"php": ">=7.2"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/polyfill",
"name": "symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Php85\\": ""
},
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php85/tree/v1.33.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2025-06-23T16:12:55+00:00"
},
{
"name": "symfony/service-contracts",
"version": "v3.6.0",
@ -3293,16 +3450,16 @@
},
{
"name": "utopia-php/abuse",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/abuse.git",
"reference": "cd591568791556d246d901d6aaf9935ab02c3f9a"
"reference": "611fa66a97e87c0dbbc133a717d970da7a5ca828"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/cd591568791556d246d901d6aaf9935ab02c3f9a",
"reference": "cd591568791556d246d901d6aaf9935ab02c3f9a",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/611fa66a97e87c0dbbc133a717d970da7a5ca828",
"reference": "611fa66a97e87c0dbbc133a717d970da7a5ca828",
"shasum": ""
},
"require": {
@ -3310,7 +3467,7 @@
"ext-pdo": "*",
"ext-redis": "*",
"php": ">=8.0",
"utopia-php/database": "2.*"
"utopia-php/database": "*"
},
"require-dev": {
"laravel/pint": "1.*",
@ -3338,9 +3495,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/abuse/issues",
"source": "https://github.com/utopia-php/abuse/tree/1.0.1"
"source": "https://github.com/utopia-php/abuse/tree/1.0.2"
},
"time": "2025-09-04T12:46:54+00:00"
"time": "2025-10-20T07:18:33+00:00"
},
{
"name": "utopia-php/analytics",
@ -3390,21 +3547,21 @@
},
{
"name": "utopia-php/audit",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/audit.git",
"reference": "5ef26d6a2ab2db7bb86288a1a6ef970307b46f22"
"reference": "8c17065c2473d4ca799f65585ca74eb53e1be211"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/5ef26d6a2ab2db7bb86288a1a6ef970307b46f22",
"reference": "5ef26d6a2ab2db7bb86288a1a6ef970307b46f22",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/8c17065c2473d4ca799f65585ca74eb53e1be211",
"reference": "8c17065c2473d4ca799f65585ca74eb53e1be211",
"shasum": ""
},
"require": {
"php": ">=8.0",
"utopia-php/database": "2.*"
"utopia-php/database": "*"
},
"require-dev": {
"laravel/pint": "1.*",
@ -3431,9 +3588,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/audit/issues",
"source": "https://github.com/utopia-php/audit/tree/1.0.1"
"source": "https://github.com/utopia-php/audit/tree/1.0.2"
},
"time": "2025-09-04T12:46:43+00:00"
"time": "2025-10-20T07:14:26+00:00"
},
{
"name": "utopia-php/auth",
@ -3690,29 +3847,31 @@
},
{
"name": "utopia-php/database",
"version": "2.3.2",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "35c978ddd20b649d119296094686d3cc9fcf161f"
"reference": "da0d583e1590e37515edfa338d8684c01833455f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/35c978ddd20b649d119296094686d3cc9fcf161f",
"reference": "35c978ddd20b649d119296094686d3cc9fcf161f",
"url": "https://api.github.com/repos/utopia-php/database/zipball/da0d583e1590e37515edfa338d8684c01833455f",
"reference": "da0d583e1590e37515edfa338d8684c01833455f",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-mongodb": "*",
"ext-pdo": "*",
"php": ">=8.1",
"utopia-php/cache": "0.13.*",
"utopia-php/framework": "0.33.*",
"utopia-php/mongo": "0.10.*",
"utopia-php/pools": "0.8.*"
},
"require-dev": {
"fakerphp/faker": "1.23.*",
"laravel/pint": "1.*",
"laravel/pint": "*",
"pcov/clobber": "2.*",
"phpstan/phpstan": "1.*",
"phpunit/phpunit": "9.*",
@ -3740,9 +3899,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/2.3.2"
"source": "https://github.com/utopia-php/database/tree/3.0.0"
},
"time": "2025-10-07T03:09:32+00:00"
"time": "2025-10-20T05:51:31+00:00"
},
{
"name": "utopia-php/detector",
@ -4242,16 +4401,16 @@
},
{
"name": "utopia-php/migration",
"version": "1.1.0",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "6fb6f8f032cd34c3c65728a55d494adeac2ff038"
"reference": "e0b6687620dd67fe2b96eb4419e8243577b11c8f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/6fb6f8f032cd34c3c65728a55d494adeac2ff038",
"reference": "6fb6f8f032cd34c3c65728a55d494adeac2ff038",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/e0b6687620dd67fe2b96eb4419e8243577b11c8f",
"reference": "e0b6687620dd67fe2b96eb4419e8243577b11c8f",
"shasum": ""
},
"require": {
@ -4259,7 +4418,7 @@
"ext-curl": "*",
"ext-openssl": "*",
"php": ">=8.1",
"utopia-php/database": "2.*",
"utopia-php/database": "3.*",
"utopia-php/dsn": "0.2.*",
"utopia-php/framework": "0.33.*",
"utopia-php/storage": "0.18.*"
@ -4292,9 +4451,70 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/1.1.0"
"source": "https://github.com/utopia-php/migration/tree/1.2.2"
},
"time": "2025-09-10T05:45:30+00:00"
"time": "2025-10-20T10:12:11+00:00"
},
{
"name": "utopia-php/mongo",
"version": "0.10.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/mongo.git",
"reference": "ecfad6aad2e2e3fe5899ac2ebf1009a21b4d6b18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/mongo/zipball/ecfad6aad2e2e3fe5899ac2ebf1009a21b4d6b18",
"reference": "ecfad6aad2e2e3fe5899ac2ebf1009a21b4d6b18",
"shasum": ""
},
"require": {
"ext-mongodb": "2.1.*",
"mongodb/mongodb": "2.1.*",
"php": ">=8.0",
"ramsey/uuid": "4.9.*"
},
"require-dev": {
"fakerphp/faker": "1.*",
"laravel/pint": "*",
"phpstan/phpstan": "*",
"phpunit/phpunit": "9.*",
"swoole/ide-helper": "5.1.*"
},
"type": "library",
"autoload": {
"psr-4": {
"Utopia\\Mongo\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "eldad@appwrite.io"
},
{
"name": "Wess",
"email": "wess@appwrite.io"
}
],
"description": "A simple library to manage Mongo database",
"keywords": [
"database",
"mongo",
"php",
"upf",
"utopia"
],
"support": {
"issues": "https://github.com/utopia-php/mongo/issues",
"source": "https://github.com/utopia-php/mongo/tree/0.10.0"
},
"time": "2025-10-02T04:50:07+00:00"
},
{
"name": "utopia-php/orchestration",
@ -4934,28 +5154,28 @@
},
{
"name": "webmozart/assert",
"version": "1.11.0",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991"
"reference": "541057574806f942c94662b817a50f63f7345360"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991",
"reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/541057574806f942c94662b817a50f63f7345360",
"reference": "541057574806f942c94662b817a50f63f7345360",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-date": "*",
"ext-filter": "*",
"php": "^7.2 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<0.12.20",
"vimeo/psalm": "<4.6.1 || 4.6.2"
},
"require-dev": {
"phpunit/phpunit": "^8.5.13"
"suggest": {
"ext-intl": "",
"ext-simplexml": "",
"ext-spl": ""
},
"type": "library",
"extra": {
@ -4986,9 +5206,9 @@
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
"source": "https://github.com/webmozarts/assert/tree/1.12.0"
},
"time": "2022-06-03T18:03:27+00:00"
"time": "2025-10-20T12:43:39+00:00"
},
{
"name": "webonyx/graphql-php",

View file

@ -160,7 +160,7 @@ class Create extends Action
throw new Exception($this->getParentInvalidTypeException(), "Cannot create an index for a relationship $contextType: " . $oldAttributes[$attributeIndex]['key']);
}
// ensure attribute is available
// Ensure attribute is available
if ($attributeStatus !== 'available') {
$contextType = ucfirst($contextType);
throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']);
@ -171,7 +171,7 @@ class Create extends Action
}
if ($attributeArray === true) {
$lengths[$i] = Database::ARRAY_INDEX_LENGTH;
$lengths[$i] = Database::MAX_ARRAY_INDEX_LENGTH;
$orders[$i] = null;
}
}
@ -190,21 +190,18 @@ class Create extends Action
'orders' => $orders,
]);
$maxIndexLength = $dbForProject->getAdapter()->getMaxIndexLength();
$internalIndexesKeys = $dbForProject->getAdapter()->getInternalIndexesKeys();
$supportForIndexArray = $dbForProject->getAdapter()->getSupportForIndexArray();
$supportForSpatialAttributes = $dbForProject->getAdapter()->getSupportForSpatialAttributes();
$supportForSpatialIndexNull = $dbForProject->getAdapter()->getSupportForSpatialIndexNull();
$supportForSpatialIndexOrder = $dbForProject->getAdapter()->getSupportForSpatialIndexOrder();
$validator = new IndexValidator(
$collection->getAttribute('attributes'),
$maxIndexLength,
$internalIndexesKeys,
$supportForIndexArray,
$supportForSpatialAttributes,
$supportForSpatialIndexNull,
$supportForSpatialIndexOrder
$collection->getAttribute('indexes'),
$dbForProject->getAdapter()->getMaxIndexLength(),
$dbForProject->getAdapter()->getInternalIndexesKeys(),
$dbForProject->getAdapter()->getSupportForIndexArray(),
$dbForProject->getAdapter()->getSupportForSpatialIndexNull(),
$dbForProject->getAdapter()->getSupportForSpatialIndexOrder(),
$dbForProject->getAdapter()->getSupportForVectors(),
$dbForProject->getAdapter()->getSupportForAttributes(),
$dbForProject->getAdapter()->getSupportForMultipleFulltextIndexes(),
$dbForProject->getAdapter()->getSupportForIdenticalIndexes()
);
if (!$validator->isValid($index)) {

View file

@ -1281,7 +1281,7 @@ trait DatabasesBase
]);
$this->assertEquals(400, $fulltextReleaseYear['headers']['status-code']);
$this->assertEquals($fulltextReleaseYear['body']['message'], 'Attribute "releaseYear" cannot be part of a FULLTEXT index, must be of type string');
$this->assertEquals($fulltextReleaseYear['body']['message'], 'Attribute "releaseYear" cannot be part of a fulltext index, must be of type string');
$noAttributes = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json',
@ -1465,7 +1465,7 @@ 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 overriden with Database::MAX_ARRAY_INDEX_LENGTH
$create = $this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$collectionId}/indexes", [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@ -1483,7 +1483,7 @@ trait DatabasesBase
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
]);
$this->assertEquals([Database::ARRAY_INDEX_LENGTH], $index['body']['lengths']);
$this->assertEquals([Database::MAX_ARRAY_INDEX_LENGTH], $index['body']['lengths']);
// Test case for count of lengths greater than attributes (should throw 400)
$create = $this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$collectionId}/indexes", [

View file

@ -1281,7 +1281,7 @@ trait DatabasesBase
]);
$this->assertEquals(400, $fulltextReleaseYear['headers']['status-code']);
$this->assertEquals($fulltextReleaseYear['body']['message'], 'Attribute "releaseYear" cannot be part of a FULLTEXT index, must be of type string');
$this->assertEquals($fulltextReleaseYear['body']['message'], 'Attribute "releaseYear" cannot be part of a fulltext index, must be of type string');
$noAttributes = $this->client->call(Client::METHOD_POST, '/tablesdb/' . $databaseId . '/tables/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json',