mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: adjust testCreateIndexes index count for MongoDB maxIndexLength=1024
MongoDB's maxIndexLength (1024) allows the 512+512 index to succeed, resulting in 5 indexes instead of 4. Use conditional count and assertContains for position-independent key checks. Verified: 830/830 Database tests pass locally on MongoDB with paratest. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Generated
+18
-18
@@ -3797,16 +3797,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "adfdf201144353a1d2ce14bb197ab746079894e0"
|
||||
"reference": "5e49f32ebb6e40a78209231564c40e5068810429"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/adfdf201144353a1d2ce14bb197ab746079894e0",
|
||||
"reference": "adfdf201144353a1d2ce14bb197ab746079894e0",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/5e49f32ebb6e40a78209231564c40e5068810429",
|
||||
"reference": "5e49f32ebb6e40a78209231564c40e5068810429",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3849,9 +3849,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/5.2.1"
|
||||
"source": "https://github.com/utopia-php/database/tree/5.3.0"
|
||||
},
|
||||
"time": "2026-02-16T11:01:13+00:00"
|
||||
"time": "2026-02-17T11:50:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/detector",
|
||||
@@ -5385,16 +5385,16 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "1.9.2",
|
||||
"version": "1.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "74de906ea5051030c5299a5d4aa74d963a531130"
|
||||
"reference": "5a8a304e404c84539f3ac6562c736f8c7ef2bef2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/74de906ea5051030c5299a5d4aa74d963a531130",
|
||||
"reference": "74de906ea5051030c5299a5d4aa74d963a531130",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/5a8a304e404c84539f3ac6562c736f8c7ef2bef2",
|
||||
"reference": "5a8a304e404c84539f3ac6562c736f8c7ef2bef2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5430,9 +5430,9 @@
|
||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||
"support": {
|
||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/1.9.2"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/1.9.3"
|
||||
},
|
||||
"time": "2026-02-16T06:59:54+00:00"
|
||||
"time": "2026-02-17T11:48:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brianium/paratest",
|
||||
@@ -6778,16 +6778,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.11",
|
||||
"version": "12.5.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "9b518cb40f9474572c9f0178e96ff3dc1cf02bf1"
|
||||
"reference": "418e06b3b46b0d54bad749ff4907fc7dfb530199"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b518cb40f9474572c9f0178e96ff3dc1cf02bf1",
|
||||
"reference": "9b518cb40f9474572c9f0178e96ff3dc1cf02bf1",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/418e06b3b46b0d54bad749ff4907fc7dfb530199",
|
||||
"reference": "418e06b3b46b0d54bad749ff4907fc7dfb530199",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6856,7 +6856,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.11"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.12"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6880,7 +6880,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-10T12:32:02+00:00"
|
||||
"time": "2026-02-16T08:34:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/cache",
|
||||
|
||||
@@ -839,6 +839,7 @@ class OpenAPI3 extends Format
|
||||
case 'string':
|
||||
case 'datetime':
|
||||
case 'payload':
|
||||
case 'id':
|
||||
$type = 'string';
|
||||
break;
|
||||
|
||||
|
||||
@@ -819,6 +819,7 @@ class Swagger2 extends Format
|
||||
switch ($rule['type']) {
|
||||
case 'string':
|
||||
case 'datetime':
|
||||
case 'id':
|
||||
$type = 'string';
|
||||
break;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ abstract class Model
|
||||
public const TYPE_PAYLOAD = 'payload';
|
||||
public const TYPE_ARRAY = 'array';
|
||||
public const TYPE_ENUM = 'enum';
|
||||
public const TYPE_ID = 'id';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
||||
@@ -37,7 +37,7 @@ class Document extends Any
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$sequence', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'type' => self::TYPE_ID,
|
||||
'description' => 'Document sequence ID.',
|
||||
'default' => '',
|
||||
'example' => '1',
|
||||
@@ -85,7 +85,7 @@ class Document extends Any
|
||||
|
||||
if (!$document->isEmpty()) {
|
||||
$sequence = $document->getAttribute('$sequence', '');
|
||||
$document->setAttribute('$sequence', (string)$sequence);
|
||||
$document->setAttribute('$sequence', $sequence);
|
||||
}
|
||||
|
||||
foreach ($document->getAttributes() as $attribute) {
|
||||
|
||||
@@ -37,7 +37,7 @@ class Row extends Any
|
||||
'example' => '5e5ea5c16897e',
|
||||
])
|
||||
->addRule('$sequence', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'type' => self::TYPE_ID,
|
||||
'description' => 'Row sequence ID.',
|
||||
'default' => '',
|
||||
'example' => '1',
|
||||
@@ -83,7 +83,7 @@ class Row extends Any
|
||||
$document->removeAttribute('$collection');
|
||||
$document->removeAttribute('$tenant');
|
||||
$sequence = $document->getAttribute('$sequence', '');
|
||||
$document->setAttribute('$sequence', (string)$sequence);
|
||||
$document->setAttribute('$sequence', $sequence);
|
||||
|
||||
foreach ($document->getAttributes() as $column) {
|
||||
if (\is_array($column)) {
|
||||
|
||||
@@ -2198,11 +2198,13 @@ trait DatabasesBase
|
||||
]), []);
|
||||
|
||||
$this->assertIsArray($collectionResponse['body']['indexes']);
|
||||
$this->assertCount(4, $collectionResponse['body']['indexes']);
|
||||
$this->assertEquals($titleIndex['body']['key'], $collectionResponse['body']['indexes'][0]['key']);
|
||||
$this->assertEquals($releaseYearIndex['body']['key'], $collectionResponse['body']['indexes'][1]['key']);
|
||||
$this->assertEquals($releaseWithDate1['body']['key'], $collectionResponse['body']['indexes'][2]['key']);
|
||||
$this->assertEquals($releaseWithDate2['body']['key'], $collectionResponse['body']['indexes'][3]['key']);
|
||||
$expectedIndexCount = $this->getMaxIndexLength() < 1024 ? 4 : 5; // MongoDB accepts tooLong index
|
||||
$this->assertCount($expectedIndexCount, $collectionResponse['body']['indexes']);
|
||||
$indexKeys = array_column($collectionResponse['body']['indexes'], 'key');
|
||||
$this->assertContains($titleIndex['body']['key'], $indexKeys);
|
||||
$this->assertContains($releaseYearIndex['body']['key'], $indexKeys);
|
||||
$this->assertContains($releaseWithDate1['body']['key'], $indexKeys);
|
||||
$this->assertContains($releaseWithDate2['body']['key'], $indexKeys);
|
||||
|
||||
$this->assertEventually(function () use ($databaseId, $collectionId) {
|
||||
$collResp = $this->client->call(Client::METHOD_GET, $this->getContainerUrl($databaseId, $collectionId), array_merge([
|
||||
|
||||
Reference in New Issue
Block a user