From 1d86a6bfe01e7847891e68e8439035cfaeec95fc Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 22 Dec 2025 18:29:16 +0200 Subject: [PATCH 1/4] Migration --- composer.json | 2 +- composer.lock | 181 +++++++----------- src/Migration/Resources/Database/Database.php | 1 + src/Migration/Sources/Appwrite.php | 4 +- src/Migration/Sources/Appwrite/Reader.php | 5 +- src/Migration/Sources/Appwrite/Reader/API.php | 8 +- .../Sources/Appwrite/Reader/Database.php | 6 +- 7 files changed, 89 insertions(+), 118 deletions(-) diff --git a/composer.json b/composer.json index 3b974e0b..967afcef 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-curl": "*", "ext-openssl": "*", "appwrite/appwrite": "15.*", - "utopia-php/database": "3.*", + "utopia-php/database": "dev-joins8 as 4.3.0", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", "utopia-php/console": "0.0.*" diff --git a/composer.lock b/composer.lock index 192872e4..a82c6b11 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": "8b2b0894b94d976f09044c200956961a", + "content-hash": "a88c69532030d85bb7e9408ccddd8192", "packages": [ { "name": "appwrite/appwrite", @@ -1280,20 +1280,20 @@ }, { "name": "ramsey/uuid", - "version": "4.9.1", + "version": "4.9.2", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440" + "reference": "8429c78ca35a09f27565311b98101e2826affde0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/81f941f6f729b1e3ceea61d9d014f8b6c6800440", - "reference": "81f941f6f729b1e3ceea61d9d014f8b6c6800440", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0", + "reference": "8429c78ca35a09f27565311b98101e2826affde0", "shasum": "" }, "require": { - "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1352,9 +1352,9 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.1" + "source": "https://github.com/ramsey/uuid/tree/4.9.2" }, - "time": "2025-09-04T20:59:21+00:00" + "time": "2025-12-14T04:43:48+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2068,16 +2068,16 @@ }, { "name": "utopia-php/cache", - "version": "0.13.1", + "version": "0.13.2", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "97220cb3b3822b166ee016d1646e2ae2815dc540" + "reference": "5768498c9f451482f0bf3eede4d6452ddcd4a0f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/97220cb3b3822b166ee016d1646e2ae2815dc540", - "reference": "97220cb3b3822b166ee016d1646e2ae2815dc540", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/5768498c9f451482f0bf3eede4d6452ddcd4a0f6", + "reference": "5768498c9f451482f0bf3eede4d6452ddcd4a0f6", "shasum": "" }, "require": { @@ -2086,7 +2086,7 @@ "ext-redis": "*", "php": ">=8.0", "utopia-php/pools": "0.8.*", - "utopia-php/telemetry": "0.1.*" + "utopia-php/telemetry": "*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2114,9 +2114,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.13.1" + "source": "https://github.com/utopia-php/cache/tree/0.13.2" }, - "time": "2025-05-09T14:43:52+00:00" + "time": "2025-12-17T08:55:43+00:00" }, { "name": "utopia-php/compression", @@ -2214,16 +2214,16 @@ }, { "name": "utopia-php/database", - "version": "3.5.0", + "version": "dev-joins8", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "5da71b65a6123ce2e78795522b05b7458aabfbd7" + "reference": "a732ab42c10bf2dbe499f7c9c2c4918baa656a52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/5da71b65a6123ce2e78795522b05b7458aabfbd7", - "reference": "5da71b65a6123ce2e78795522b05b7458aabfbd7", + "url": "https://api.github.com/repos/utopia-php/database/zipball/a732ab42c10bf2dbe499f7c9c2c4918baa656a52", + "reference": "a732ab42c10bf2dbe499f7c9c2c4918baa656a52", "shasum": "" }, "require": { @@ -2266,9 +2266,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/3.5.0" + "source": "https://github.com/utopia-php/database/tree/joins8" }, - "time": "2025-11-18T08:11:01+00:00" + "time": "2025-12-18T13:55:36+00:00" }, { "name": "utopia-php/dsn", @@ -2319,23 +2319,21 @@ }, { "name": "utopia-php/framework", - "version": "0.33.33", + "version": "0.33.11", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "838e3a28276e73187bc34a314f014096dc92191b" + "reference": "354ff0d23bfc6e82bea0fe8e89e115cff1af8466" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/838e3a28276e73187bc34a314f014096dc92191b", - "reference": "838e3a28276e73187bc34a314f014096dc92191b", + "url": "https://api.github.com/repos/utopia-php/http/zipball/354ff0d23bfc6e82bea0fe8e89e115cff1af8466", + "reference": "354ff0d23bfc6e82bea0fe8e89e115cff1af8466", "shasum": "" }, "require": { - "php": ">=8.1", - "utopia-php/compression": "0.1.*", - "utopia-php/telemetry": "0.1.*", - "utopia-php/validators": "0.1.*" + "php": ">=8.0", + "utopia-php/compression": "0.1.*" }, "require-dev": { "laravel/pint": "^1.2", @@ -2361,9 +2359,9 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.33" + "source": "https://github.com/utopia-php/http/tree/0.33.11" }, - "time": "2025-11-25T10:21:13+00:00" + "time": "2024-11-08T18:47:43+00:00" }, { "name": "utopia-php/mongo", @@ -2428,21 +2426,21 @@ }, { "name": "utopia-php/pools", - "version": "0.8.2", + "version": "0.8.3", "source": { "type": "git", "url": "https://github.com/utopia-php/pools.git", - "reference": "05c67aba42eb68ac65489cc1e7fc5db83db2dd4d" + "reference": "ad7d6ba946376e81c603204285ce9a674b6502b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/pools/zipball/05c67aba42eb68ac65489cc1e7fc5db83db2dd4d", - "reference": "05c67aba42eb68ac65489cc1e7fc5db83db2dd4d", + "url": "https://api.github.com/repos/utopia-php/pools/zipball/ad7d6ba946376e81c603204285ce9a674b6502b8", + "reference": "ad7d6ba946376e81c603204285ce9a674b6502b8", "shasum": "" }, "require": { - "php": ">=8.3", - "utopia-php/telemetry": "0.1.*" + "php": ">=8.4", + "utopia-php/telemetry": "*" }, "require-dev": { "laravel/pint": "1.*", @@ -2474,22 +2472,22 @@ ], "support": { "issues": "https://github.com/utopia-php/pools/issues", - "source": "https://github.com/utopia-php/pools/tree/0.8.2" + "source": "https://github.com/utopia-php/pools/tree/0.8.3" }, - "time": "2025-04-17T02:04:54+00:00" + "time": "2025-12-17T09:35:18+00:00" }, { "name": "utopia-php/storage", - "version": "0.18.16", + "version": "0.18.19", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "0c7b8ad68de8e1eb23ccc8af9f27a30eb832930f" + "reference": "9c3f9a471250d22de7d405ee19e23e72b14181ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/0c7b8ad68de8e1eb23ccc8af9f27a30eb832930f", - "reference": "0c7b8ad68de8e1eb23ccc8af9f27a30eb832930f", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/9c3f9a471250d22de7d405ee19e23e72b14181ca", + "reference": "9c3f9a471250d22de7d405ee19e23e72b14181ca", "shasum": "" }, "require": { @@ -2505,7 +2503,7 @@ "php": ">=8.1", "utopia-php/framework": "0.*.*", "utopia-php/system": "0.*.*", - "utopia-php/telemetry": "0.1.*" + "utopia-php/telemetry": "0.2.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2532,9 +2530,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.16" + "source": "https://github.com/utopia-php/storage/tree/0.18.19" }, - "time": "2025-12-03T02:15:45+00:00" + "time": "2025-12-17T13:55:20+00:00" }, { "name": "utopia-php/system", @@ -2594,32 +2592,37 @@ }, { "name": "utopia-php/telemetry", - "version": "0.1.1", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/telemetry.git", - "reference": "437f0021777f0e575dfb9e8a1a081b3aed75e33f" + "reference": "9997ebf59bb77920a7223ad73d834a76b09152c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/437f0021777f0e575dfb9e8a1a081b3aed75e33f", - "reference": "437f0021777f0e575dfb9e8a1a081b3aed75e33f", + "url": "https://api.github.com/repos/utopia-php/telemetry/zipball/9997ebf59bb77920a7223ad73d834a76b09152c3", + "reference": "9997ebf59bb77920a7223ad73d834a76b09152c3", "shasum": "" }, "require": { "ext-opentelemetry": "*", "ext-protobuf": "*", - "nyholm/psr7": "^1.8", - "open-telemetry/exporter-otlp": "^1.1", - "open-telemetry/sdk": "^1.1", + "nyholm/psr7": "1.*", + "open-telemetry/exporter-otlp": "1.*", + "open-telemetry/sdk": "1.*", "php": ">=8.0", - "symfony/http-client": "^7.1" + "symfony/http-client": "7.*" }, "require-dev": { - "laravel/pint": "^1.2", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.5.25" + "laravel/pint": "1.*", + "phpbench/phpbench": "1.*", + "phpstan/phpstan": "2.*", + "phpunit/phpunit": "11.*", + "swoole/ide-helper": "6.*" + }, + "suggest": { + "ext-sockets": "Required for the Swoole transport implementation", + "ext-swoole": "Required for the Swoole transport implementation" }, "type": "library", "autoload": { @@ -2638,54 +2641,9 @@ ], "support": { "issues": "https://github.com/utopia-php/telemetry/issues", - "source": "https://github.com/utopia-php/telemetry/tree/0.1.1" - }, - "time": "2025-03-17T11:57:52+00:00" - }, - { - "name": "utopia-php/validators", - "version": "0.1.0", - "source": { - "type": "git", - "url": "https://github.com/utopia-php/validators.git", - "reference": "5c57d5b6cf964f8981807c1d3ea8df620c869080" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/utopia-php/validators/zipball/5c57d5b6cf964f8981807c1d3ea8df620c869080", - "reference": "5c57d5b6cf964f8981807c1d3ea8df620c869080", - "shasum": "" - }, - "require": { - "php": ">=8.0" - }, - "require-dev": { - "laravel/pint": "1.*", - "phpstan/phpstan": "1.*", - "phpunit/phpunit": "11.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Utopia\\": "src/" - } + "source": "https://github.com/utopia-php/telemetry/tree/0.2.0" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A lightweight collection of reusable validators for Utopia projects", - "keywords": [ - "php", - "utopia", - "validation", - "validator" - ], - "support": { - "issues": "https://github.com/utopia-php/validators/issues", - "source": "https://github.com/utopia-php/validators/tree/0.1.0" - }, - "time": "2025-11-18T11:05:46+00:00" + "time": "2025-12-17T07:56:38+00:00" } ], "packages-dev": [ @@ -4966,9 +4924,18 @@ "time": "2025-04-30T23:37:27+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-joins8", + "alias": "4.3.0", + "alias_normalized": "4.3.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 06882b21..8a911c41 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 4216d40f..9bdbf0cf 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -1143,7 +1143,9 @@ private function exportRows(int $batchSize): void } /** @var Column|Relationship $attribute */ - $queries[] = $this->database->querySelect($selects); + foreach ($selects as $select) { + $queries[] = $this->database->querySelect($select); + } $response = $this->database->listRows($table, $queries); diff --git a/src/Migration/Sources/Appwrite/Reader.php b/src/Migration/Sources/Appwrite/Reader.php index b45f2bdc..5a217894 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; @@ -77,10 +78,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 da1a5022..20141b00 100644 --- a/src/Migration/Sources/Appwrite/Reader/API.php +++ b/src/Migration/Sources/Appwrite/Reader/API.php @@ -205,12 +205,12 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr } /** - * @param array $columns - * @return string + * @param string $column + * @return Query */ - 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 c43e246c..8b6e1f5d 100644 --- a/src/Migration/Sources/Appwrite/Reader/Database.php +++ b/src/Migration/Sources/Appwrite/Reader/Database.php @@ -353,12 +353,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); } /** From ae04b1154faf89e40f197f01e83519fde0861b3c Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 22 Dec 2025 18:39:24 +0200 Subject: [PATCH 2/4] Migration --- src/Migration/Sources/Appwrite/Reader/API.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Migration/Sources/Appwrite/Reader/API.php b/src/Migration/Sources/Appwrite/Reader/API.php index 20141b00..02e2ef2e 100644 --- a/src/Migration/Sources/Appwrite/Reader/API.php +++ b/src/Migration/Sources/Appwrite/Reader/API.php @@ -210,7 +210,10 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr */ public function querySelect(string $column): string { - return Query::select($column); + /** + * Hack turn to array until fix + */ + return Query::select([$column]); } /** From 98dd1459120da7d5f03f360814a0dce8ac9569da Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 22 Dec 2025 18:43:45 +0200 Subject: [PATCH 3/4] select --- src/Migration/Sources/Appwrite/Reader/API.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Migration/Sources/Appwrite/Reader/API.php b/src/Migration/Sources/Appwrite/Reader/API.php index 02e2ef2e..20141b00 100644 --- a/src/Migration/Sources/Appwrite/Reader/API.php +++ b/src/Migration/Sources/Appwrite/Reader/API.php @@ -210,10 +210,7 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr */ public function querySelect(string $column): string { - /** - * Hack turn to array until fix - */ - return Query::select([$column]); + return Query::select($column); } /** From 01e06cf23b120b20eff6b159bc6531dd412677d8 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 23 Dec 2025 07:59:18 +0200 Subject: [PATCH 4/4] fallback query select --- src/Migration/Sources/Appwrite/Reader/API.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Migration/Sources/Appwrite/Reader/API.php b/src/Migration/Sources/Appwrite/Reader/API.php index 20141b00..d71d1060 100644 --- a/src/Migration/Sources/Appwrite/Reader/API.php +++ b/src/Migration/Sources/Appwrite/Reader/API.php @@ -210,6 +210,11 @@ public function getRow(Table $resource, string $rowId, array $queries = []): arr */ public function querySelect(string $column): string { + return new Query('select', $column); + + /** + * todo fix Query::select to get attribute not array + */ return Query::select($column); }