From 531b84c7f58b7bcb45eebc8960c013468be1f239 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 12:48:06 +0200 Subject: [PATCH 1/9] create index --- tests/e2e/Adapter/Base.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 398c92151..923a828b6 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1120,6 +1120,10 @@ public function testCreateIndex(): void $database = $this->getDatabase(); $database->createCollection('indexes'); + + $database->createAttribute('indexes', 'int.2', Database::VAR_STRING, 100, false); + $database->createIndex('indexes', 'index_111', Database::INDEX_KEY, ['int.2']); + $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); $database->createIndex('indexes', 'index_1', Database::INDEX_KEY, ['name']); From 7cd1fe9a6e90361930219524c668d9a2cfa74900 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 14:10:04 +0200 Subject: [PATCH 2/9] create index ticks --- src/Database/Adapter/MariaDB.php | 2 +- src/Database/Database.php | 2 +- tests/e2e/Adapter/Base.php | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Database/Adapter/MariaDB.php b/src/Database/Adapter/MariaDB.php index 86927c3c5..1615274d2 100644 --- a/src/Database/Adapter/MariaDB.php +++ b/src/Database/Adapter/MariaDB.php @@ -772,7 +772,7 @@ public function createIndex(string $collection, string $id, string $type, array $attributes[$i] = "`{$attr}`{$length} {$order}"; if (!empty($collectionAttribute['array']) && $this->getSupportForCastIndexArray()) { - $attributes[$i] = '(CAST(' . $attr . ' AS char(' . Database::ARRAY_INDEX_LENGTH . ') ARRAY))'; + $attributes[$i] = '(CAST(`' . $attr . '` AS char(' . Database::ARRAY_INDEX_LENGTH . ') ARRAY))'; } } diff --git a/src/Database/Database.php b/src/Database/Database.php index 9ef753f13..d746ec55b 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -2843,7 +2843,7 @@ public function createIndex(string $collection, string $id, string $type, array $created = $this->adapter->createIndex($collection->getId(), $id, $type, $attributes, $lengths, $orders); if (!$created) { - throw new DatabaseException('Failed to create index'); + //throw new DatabaseException('Failed to create index'); } } catch (DuplicateException $e) { // HACK: Metadata should still be updated, can be removed when null tenant collections are supported. diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 923a828b6..f190fed6b 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1121,8 +1121,13 @@ public function testCreateIndex(): void $database->createCollection('indexes'); - $database->createAttribute('indexes', 'int.2', Database::VAR_STRING, 100, false); - $database->createIndex('indexes', 'index_111', Database::INDEX_KEY, ['int.2']); + /** + * Check ticks + */ + $database->createAttribute('indexes', 'int-1', Database::VAR_INTEGER, 8, false, array:true); + $database->createAttribute('indexes', 'int.2', Database::VAR_INTEGER, 8, false, array:true); + $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int-1']); + $database->createIndex('indexes', 'indx8712', Database::INDEX_KEY, ['int.2']); $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); From 2ca9a9315f98ed785146f4d5ac442936f117fcb8 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 14:23:36 +0200 Subject: [PATCH 3/9] Revert throw --- src/Database/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Database/Database.php b/src/Database/Database.php index d746ec55b..9ef753f13 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -2843,7 +2843,7 @@ public function createIndex(string $collection, string $id, string $type, array $created = $this->adapter->createIndex($collection->getId(), $id, $type, $attributes, $lengths, $orders); if (!$created) { - //throw new DatabaseException('Failed to create index'); + throw new DatabaseException('Failed to create index'); } } catch (DuplicateException $e) { // HACK: Metadata should still be updated, can be removed when null tenant collections are supported. From 9bcaa34d926d0c847d46e82628f272dbfedc61fa Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 15:58:04 +0200 Subject: [PATCH 4/9] reserve words --- tests/e2e/Adapter/Base.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index f190fed6b..b3c8434bc 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1121,13 +1121,13 @@ public function testCreateIndex(): void $database->createCollection('indexes'); - /** - * Check ticks - */ - $database->createAttribute('indexes', 'int-1', Database::VAR_INTEGER, 8, false, array:true); - $database->createAttribute('indexes', 'int.2', Database::VAR_INTEGER, 8, false, array:true); - $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int-1']); - $database->createIndex('indexes', 'indx8712', Database::INDEX_KEY, ['int.2']); + if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { + /** + * Check ticks sounding create index reserve words + */ + $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); + $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int']); + } $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); From 35706705138be3fb566d68c5da1df5c4950084d3 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 15:58:35 +0200 Subject: [PATCH 5/9] reserve words --- tests/e2e/Adapter/Base.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index b3c8434bc..0a439c082 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1121,13 +1121,14 @@ public function testCreateIndex(): void $database->createCollection('indexes'); - if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { - /** - * Check ticks sounding create index reserve words - */ - $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); - $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int']); - } + $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); + $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int']); + +// if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { +// /** +// * Check ticks sounding create index reserve words +// */ +// } $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); From bcb3e4cb0f8e7ee129d6f2b5e495bb06de9e12c4 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 16:05:54 +0200 Subject: [PATCH 6/9] Pull main --- composer.lock | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/composer.lock b/composer.lock index 84049247e..1bfbc9925 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": "43c3ff88660f90baf3ddf7ec8bc5136d", + "content-hash": "b4d67913e48d1045314c24546a49da46", "packages": [ { "name": "brick/math", @@ -465,16 +465,16 @@ }, { "name": "open-telemetry/api", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d" + "reference": "74b1a03263be8c5acb578f41da054b4bac3af4a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/351a30baa79699de3de3a814c8ccc7b52ccdfb1d", - "reference": "351a30baa79699de3de3a814c8ccc7b52ccdfb1d", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/74b1a03263be8c5acb578f41da054b4bac3af4a0", + "reference": "74b1a03263be8c5acb578f41da054b4bac3af4a0", "shasum": "" }, "require": { @@ -531,7 +531,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-01-08T23:50:34+00:00" + "time": "2025-01-20T23:35:16+00:00" }, { "name": "open-telemetry/context", @@ -721,16 +721,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127" + "reference": "96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/9a1c3b866239dbff291e5cc555bb7793eab08127", - "reference": "9a1c3b866239dbff291e5cc555bb7793eab08127", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1", + "reference": "96aeaee5b7cb8c0bc4af7ff4717b429f2d9f67e1", "shasum": "" }, "require": { @@ -807,7 +807,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-01-08T23:50:34+00:00" + "time": "2025-01-09T23:17:14+00:00" }, { "name": "open-telemetry/sem-conv", @@ -1458,16 +1458,16 @@ }, { "name": "symfony/http-client", - "version": "v7.2.2", + "version": "v7.2.3", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "339ba21476eb184290361542f732ad12c97591ec" + "reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/339ba21476eb184290361542f732ad12c97591ec", - "reference": "339ba21476eb184290361542f732ad12c97591ec", + "url": "https://api.github.com/repos/symfony/http-client/zipball/7ce6078c79a4a7afff931c413d2959d3bffbfb8d", + "reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d", "shasum": "" }, "require": { @@ -1533,7 +1533,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.2.2" + "source": "https://github.com/symfony/http-client/tree/v7.2.3" }, "funding": [ { @@ -1549,7 +1549,7 @@ "type": "tidelift" } ], - "time": "2024-12-30T18:35:15+00:00" + "time": "2025-01-28T15:51:35+00:00" }, { "name": "symfony/http-client-contracts", @@ -4349,14 +4349,14 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=8.3", + "php": ">=8.1", "ext-pdo": "*", "ext-mbstring": "*" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } From acc87d3c2b347c9076d4fea936a1593c71c89f99 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 16:07:21 +0200 Subject: [PATCH 7/9] lint --- tests/e2e/Adapter/Base.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 0a439c082..346bb572a 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1124,11 +1124,11 @@ public function testCreateIndex(): void $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int']); -// if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { -// /** -// * Check ticks sounding create index reserve words -// */ -// } + // if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { + // /** + // * Check ticks sounding create index reserve words + // */ + // } $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); From ed4ce3c4c42923d91c4242902ee7800a45fa1fa2 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 16:24:14 +0200 Subject: [PATCH 8/9] Add index length --- tests/e2e/Adapter/Base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 346bb572a..1351dbd10 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1122,7 +1122,7 @@ public function testCreateIndex(): void $database->createCollection('indexes'); $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); - $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int']); + $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int'], [255]); // if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { // /** From 08855a5d911039d5fc8f51613594a8876a4eea38 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 4 Feb 2025 18:11:27 +0200 Subject: [PATCH 9/9] Remove comment --- tests/e2e/Adapter/Base.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/e2e/Adapter/Base.php b/tests/e2e/Adapter/Base.php index 1351dbd10..4bef96a01 100644 --- a/tests/e2e/Adapter/Base.php +++ b/tests/e2e/Adapter/Base.php @@ -1121,15 +1121,12 @@ public function testCreateIndex(): void $database->createCollection('indexes'); + /** + * Check ticks sounding cast index for reserved words + */ $database->createAttribute('indexes', 'int', Database::VAR_INTEGER, 8, false, array:true); $database->createIndex('indexes', 'indx8711', Database::INDEX_KEY, ['int'], [255]); - // if ($this->getDatabase()->getAdapter()->getSupportForCastIndexArray()) { - // /** - // * Check ticks sounding create index reserve words - // */ - // } - $database->createAttribute('indexes', 'name', Database::VAR_STRING, 10, false); $database->createIndex('indexes', 'index_1', Database::INDEX_KEY, ['name']);