diff --git a/composer.json b/composer.json index 3430b0e..6dafd24 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-curl": "*", "ext-openssl": "*", "appwrite/appwrite": "19.*", - "utopia-php/database": "5.*", + "utopia-php/database": "dev-joins8 as 5.0.0", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", "halaxa/json-machine": "^1.2" diff --git a/composer.lock b/composer.lock index ee17709..62a153e 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": "29e79affc489fb76f06516f9821306d2", + "content-hash": "306eaf140e5006358964745d0dbf0875", "packages": [ { "name": "appwrite/appwrite", @@ -50,16 +50,16 @@ }, { "name": "brick/math", - "version": "0.14.1", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0" + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0", + "url": "https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629", + "reference": "63422359a44b7f06cae63c3b429b59e8efcc0629", "shasum": "" }, "require": { @@ -98,7 +98,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.1" + "source": "https://github.com/brick/math/tree/0.14.8" }, "funding": [ { @@ -106,7 +106,7 @@ "type": "github" } ], - "time": "2025-11-24T14:40:29+00:00" + "time": "2026-02-10T14:33:43+00:00" }, { "name": "composer/semver", @@ -643,16 +643,16 @@ }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/283a0d66522f2adc6d8d7debfd7686be91c282be", + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be", "shasum": "" }, "require": { @@ -703,7 +703,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-15T09:31:34+00:00" + "time": "2026-02-05T09:44:52+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -770,16 +770,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.12.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0" + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/7f1bd524465c1ca42755a9ef1143ba09913f5be0", - "reference": "7f1bd524465c1ca42755a9ef1143ba09913f5be0", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/c76f91203bf7ef98ab3f4e0a82ca21699af185e1", + "reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1", "shasum": "" }, "require": { @@ -863,7 +863,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-21T04:14:03+00:00" + "time": "2026-01-28T11:38:11+00:00" }, { "name": "open-telemetry/sem-conv", @@ -2228,16 +2228,16 @@ }, { "name": "utopia-php/database", - "version": "5.0.0", + "version": "dev-joins8", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "221794bd7de027f9177cd325209e8162ca2520cb" + "reference": "ba6763fad1e9be986c0e31ffe344a65298b62468" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/221794bd7de027f9177cd325209e8162ca2520cb", - "reference": "221794bd7de027f9177cd325209e8162ca2520cb", + "url": "https://api.github.com/repos/utopia-php/database/zipball/ba6763fad1e9be986c0e31ffe344a65298b62468", + "reference": "ba6763fad1e9be986c0e31ffe344a65298b62468", "shasum": "" }, "require": { @@ -2280,9 +2280,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/5.0.0" + "source": "https://github.com/utopia-php/database/tree/joins8" }, - "time": "2026-01-30T06:17:53+00:00" + "time": "2026-02-11T13:08:54+00:00" }, { "name": "utopia-php/dsn", @@ -2493,28 +2493,23 @@ }, { "name": "utopia-php/storage", - "version": "0.18.22", + "version": "0.18.24", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "c46bd78c1f52281df89f8921159782b20260ce31" + "reference": "9dbc0b0130677e47e05b6ba792f3157393c5948f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/c46bd78c1f52281df89f8921159782b20260ce31", - "reference": "c46bd78c1f52281df89f8921159782b20260ce31", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/9dbc0b0130677e47e05b6ba792f3157393c5948f", + "reference": "9dbc0b0130677e47e05b6ba792f3157393c5948f", "shasum": "" }, "require": { - "ext-brotli": "*", "ext-curl": "*", "ext-fileinfo": "*", - "ext-lz4": "*", "ext-simplexml": "*", - "ext-snappy": "*", - "ext-xz": "*", "ext-zlib": "*", - "ext-zstd": "*", "php": ">=8.1", "utopia-php/system": "0.*.*", "utopia-php/telemetry": "0.2.*", @@ -2545,9 +2540,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.22" + "source": "https://github.com/utopia-php/storage/tree/0.18.24" }, - "time": "2026-01-15T01:36:39+00:00" + "time": "2026-02-10T10:25:55+00:00" }, { "name": "utopia-php/system", @@ -2771,16 +2766,16 @@ }, { "name": "laravel/pint", - "version": "v1.27.0", + "version": "v1.27.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90" + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/c67b4195b75491e4dfc6b00b1c78b68d86f54c90", - "reference": "c67b4195b75491e4dfc6b00b1c78b68d86f54c90", + "url": "https://api.github.com/repos/laravel/pint/zipball/54cca2de13790570c7b6f0f94f37896bee4abcb5", + "reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5", "shasum": "" }, "require": { @@ -2791,13 +2786,13 @@ "php": "^8.2.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.92.4", - "illuminate/view": "^12.44.0", - "larastan/larastan": "^3.8.1", - "laravel-zero/framework": "^12.0.4", + "friendsofphp/php-cs-fixer": "^3.93.1", + "illuminate/view": "^12.51.0", + "larastan/larastan": "^3.9.2", + "laravel-zero/framework": "^12.0.5", "mockery/mockery": "^1.6.12", "nunomaduro/termwind": "^2.3.3", - "pestphp/pest": "^3.8.4" + "pestphp/pest": "^3.8.5" }, "bin": [ "builds/pint" @@ -2834,7 +2829,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2026-01-05T16:49:17+00:00" + "time": "2026-02-10T20:00:20+00:00" }, { "name": "myclabs/deep-copy", @@ -3292,28 +3287,28 @@ }, { "name": "phpunit/php-file-iterator", - "version": "5.1.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", - "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -3341,15 +3336,27 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" } ], - "time": "2024-08-27T05:02:59+00:00" + "time": "2026-02-02T13:52:54+00:00" }, { "name": "phpunit/php-invoker", @@ -3537,16 +3544,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.50", + "version": "11.5.53", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3" + "reference": "a997a653a82845f1240d73ee73a8a4e97e4b0607" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", - "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a997a653a82845f1240d73ee73a8a4e97e4b0607", + "reference": "a997a653a82845f1240d73ee73a8a4e97e4b0607", "shasum": "" }, "require": { @@ -3561,7 +3568,7 @@ "phar-io/version": "^3.2.1", "php": ">=8.2", "phpunit/php-code-coverage": "^11.0.12", - "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-file-iterator": "^5.1.1", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", @@ -3573,6 +3580,7 @@ "sebastian/exporter": "^6.3.2", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", + "sebastian/recursion-context": "^6.0.3", "sebastian/type": "^5.1.3", "sebastian/version": "^5.0.2", "staabm/side-effects-detector": "^1.0.5" @@ -3618,7 +3626,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.50" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.53" }, "funding": [ { @@ -3642,7 +3650,7 @@ "type": "tidelift" } ], - "time": "2026-01-27T05:59:18+00:00" + "time": "2026-02-10T12:28:25+00:00" }, { "name": "sebastian/cli-parser", @@ -4984,9 +4992,18 @@ "time": "2025-12-27T19:49:13+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-joins8", + "alias": "5.0.0", + "alias_normalized": "5.0.0.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Migration/Resources/Database/Database.php b/src/Migration/Resources/Database/Database.php index 06882b2..8a911c4 100644 --- a/src/Migration/Resources/Database/Database.php +++ b/src/Migration/Resources/Database/Database.php @@ -38,6 +38,7 @@ public function __construct( * updatedAt: string, * enabled: bool, * originalId: string|null, + * type: string|null, * } $array */ public static function fromArray(array $array): self diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index 3f4a004..7602626 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -1119,6 +1119,11 @@ private function exportRows(int $batchSize): void } $selects = ['*', '$id', '$permissions', '$updatedAt', '$createdAt']; // We want relations flat! + + foreach ($selects as $select) { + $queries[] = $this->database->querySelect($select); + } + $manyToMany = []; $attributes = $this->cache->get(Column::getName()); @@ -1142,22 +1147,22 @@ private function exportRows(int $batchSize): void } /** @var Column|Relationship $attribute */ - $queries[] = $this->database->querySelect($selects); - $response = $this->database->listRows($table, $queries); foreach ($response as $row) { // HACK: Handle many to many if (!empty($manyToMany)) { - $stack = ['$id']; // Adding $id because we can't select only relations + $queries = []; + $queries[] = $this->database->querySelect('$id'); // Adding $id because we can't select only relations + foreach ($manyToMany as $relation) { - $stack[] = $relation . '.$id'; + $queries[] = $this->database->querySelect($relation . '.$id'); } $rowItem = $this->database->getRow( $table, $row['$id'], - [$this->database->querySelect($stack)] + $queries ); foreach ($manyToMany as $key) { diff --git a/src/Migration/Sources/Appwrite/Reader.php b/src/Migration/Sources/Appwrite/Reader.php index 314d4c3..90645c8 100644 --- a/src/Migration/Sources/Appwrite/Reader.php +++ b/src/Migration/Sources/Appwrite/Reader.php @@ -2,6 +2,7 @@ namespace Utopia\Migration\Sources\Appwrite; +use Utopia\Database\Query; use Utopia\Migration\Resource; use Utopia\Migration\Resources\Database\Database; use Utopia\Migration\Resources\Database\Table; @@ -78,10 +79,10 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr /** * Return a query to select the given attributes * - * @param array $columns + * @param string $column * @return QueryType|string */ - public function querySelect(array $columns): mixed; + public function querySelect(string $column): mixed; /** * Return a query to filter the given attributes diff --git a/src/Migration/Sources/Appwrite/Reader/API.php b/src/Migration/Sources/Appwrite/Reader/API.php index 388a0ce..a95360c 100644 --- a/src/Migration/Sources/Appwrite/Reader/API.php +++ b/src/Migration/Sources/Appwrite/Reader/API.php @@ -212,12 +212,12 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr } /** - * @param array $columns + * @param string $column * @return string */ - public function querySelect(array $columns): string + public function querySelect(string $column): string { - return Query::select($columns); + return Query::select([$column]); } /** diff --git a/src/Migration/Sources/Appwrite/Reader/Database.php b/src/Migration/Sources/Appwrite/Reader/Database.php index bad744c..234b42a 100644 --- a/src/Migration/Sources/Appwrite/Reader/Database.php +++ b/src/Migration/Sources/Appwrite/Reader/Database.php @@ -360,12 +360,12 @@ public function getRow(TableResource $resource, string $rowId, array $queries = } /** - * @param array $columns + * @param string $column * @return Query */ - public function querySelect(array $columns): Query + public function querySelect(string $column): Query { - return Query::select($columns); + return Query::select($column); } /**