From bef2ad136a86a7747675e0e877f38a8ffe44c39f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 23 May 2025 03:27:01 +1200 Subject: [PATCH 1/3] Change internal ID to sequence --- README.md | 2 +- bin/MigrationCLI.php | 4 +- composer.json | 2 +- composer.lock | 278 ++++++++++-------- src/Migration/Cache.php | 16 +- src/Migration/Destinations/Appwrite.php | 74 ++--- src/Migration/Resource.php | 10 +- src/Migration/Sources/Appwrite.php | 6 +- .../Sources/Appwrite/Reader/Database.php | 36 +-- 9 files changed, 230 insertions(+), 198 deletions(-) diff --git a/README.md b/README.md index 635251bc..c021e60f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Total Downloads](https://img.shields.io/packagist/dt/utopia-php/migration.svg) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://appwrite.io/discord) -Utopia Migration is a simple and lite library to migrate and transform resources inbetween services. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io). +Utopia Migration is a simple and lite library to migrate and transform resources in-between services. This library is aiming to be as simple and easy to learn and use. This library is maintained by the [Appwrite team](https://appwrite.io). Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework. diff --git a/bin/MigrationCLI.php b/bin/MigrationCLI.php index 5994b0b5..ab616333 100644 --- a/bin/MigrationCLI.php +++ b/bin/MigrationCLI.php @@ -271,7 +271,7 @@ function (mixed $value) { }, function (mixed $value, Document $document, Database $database) { $attributes = $database->find('attributes', [ - Query::equal('collectionInternalId', [$document->getInternalId()]), + Query::equal('collectionInternalId', [$document->getSequence()]), Query::equal('databaseInternalId', [$document->getAttribute('databaseInternalId')]), Query::limit($database->getLimitForAttributes()), ]); @@ -298,7 +298,7 @@ function (mixed $value) { function (mixed $value, Document $document, Database $database) { return $database ->find('indexes', [ - Query::equal('collectionInternalId', [$document->getInternalId()]), + Query::equal('collectionInternalId', [$document->getSequence()]), Query::equal('databaseInternalId', [$document->getAttribute('databaseInternalId')]), Query::limit($database->getLimitForIndexes()), ]); diff --git a/composer.json b/composer.json index 4405cf7c..dfe85fb3 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-curl": "*", "ext-openssl": "*", "appwrite/appwrite": "11.*", - "utopia-php/database": "0.*.*", + "utopia-php/database": "dev-feat-internal-to-sequence as 0.65.5", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*" diff --git a/composer.lock b/composer.lock index 6e04f416..29f4b5d2 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": "debf6e30f1e56bf0f792191a28277302", + "content-hash": "7def39bcfecbe7a58ebb612527d5b7f5", "packages": [ { "name": "appwrite/appwrite", @@ -191,16 +191,16 @@ }, { "name": "google/protobuf", - "version": "v4.30.2", + "version": "v4.31.0", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced" + "reference": "d59e31ce4bf0e4b48728e90c4d880839edb5be07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/a4c4d8565b40b9f76debc9dfeb221412eacb8ced", - "reference": "a4c4d8565b40b9f76debc9dfeb221412eacb8ced", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/d59e31ce4bf0e4b48728e90c4d880839edb5be07", + "reference": "d59e31ce4bf0e4b48728e90c4d880839edb5be07", "shasum": "" }, "require": { @@ -229,9 +229,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.30.2" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.31.0" }, - "time": "2025-03-26T18:01:50+00:00" + "time": "2025-05-14T16:17:23+00:00" }, { "name": "nyholm/psr7", @@ -379,16 +379,16 @@ }, { "name": "open-telemetry/api", - "version": "1.2.3", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "199d7ddda88f5f5619fa73463f1a5a7149ccd1f1" + "reference": "4e3bb38e069876fb73c2ce85c89583bf2b28cd86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/199d7ddda88f5f5619fa73463f1a5a7149ccd1f1", - "reference": "199d7ddda88f5f5619fa73463f1a5a7149ccd1f1", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/4e3bb38e069876fb73c2ce85c89583bf2b28cd86", + "reference": "4e3bb38e069876fb73c2ce85c89583bf2b28cd86", "shasum": "" }, "require": { @@ -445,20 +445,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-03-05T21:42:54+00:00" + "time": "2025-05-07T12:32:21+00:00" }, { "name": "open-telemetry/context", - "version": "1.1.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/context.git", - "reference": "0cba875ea1953435f78aec7f1d75afa87bdbf7f3" + "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/0cba875ea1953435f78aec7f1d75afa87bdbf7f3", - "reference": "0cba875ea1953435f78aec7f1d75afa87bdbf7f3", + "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/1eb2b837ee9362db064a6b65d5ecce15a9f9f020", + "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020", "shasum": "" }, "require": { @@ -504,20 +504,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2024-08-21T00:29:20+00:00" + "time": "2025-05-07T23:36:50+00:00" }, { "name": "open-telemetry/exporter-otlp", - "version": "1.2.1", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "b7580440b7481a98da97aceabeb46e1b276c8747" + "reference": "8b3ca1f86d01429c73b407bf1a2075d9c187001e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/b7580440b7481a98da97aceabeb46e1b276c8747", - "reference": "b7580440b7481a98da97aceabeb46e1b276c8747", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/8b3ca1f86d01429c73b407bf1a2075d9c187001e", + "reference": "8b3ca1f86d01429c73b407bf1a2075d9c187001e", "shasum": "" }, "require": { @@ -568,7 +568,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-03-06T23:21:56+00:00" + "time": "2025-05-21T12:02:20+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", @@ -635,16 +635,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.2.3", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "0e7804c176c4b09d95b7985400aa38ce544cb7fc" + "reference": "cd0d7367599717fc29e04eb8838ec061e6c2c657" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/0e7804c176c4b09d95b7985400aa38ce544cb7fc", - "reference": "0e7804c176c4b09d95b7985400aa38ce544cb7fc", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/cd0d7367599717fc29e04eb8838ec061e6c2c657", + "reference": "cd0d7367599717fc29e04eb8838ec061e6c2c657", "shasum": "" }, "require": { @@ -721,20 +721,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-04-08T09:55:41+00:00" + "time": "2025-05-22T02:33:34+00:00" }, { "name": "open-telemetry/sem-conv", - "version": "1.30.0", + "version": "1.32.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a" + "reference": "16585cc0dbc3032a318e274043454679430d2ebf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a", - "reference": "4178c9f390da8e4dbca9b181a9d1efd50cf7ee0a", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/16585cc0dbc3032a318e274043454679430d2ebf", + "reference": "16585cc0dbc3032a318e274043454679430d2ebf", "shasum": "" }, "require": { @@ -778,7 +778,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-02-06T00:21:48+00:00" + "time": "2025-05-05T03:58:53+00:00" }, { "name": "php-http/discovery", @@ -1532,19 +1532,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", - "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -1592,7 +1593,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" }, "funding": [ { @@ -1608,11 +1609,11 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2024-12-23T08:48:59+00:00" }, { "name": "symfony/polyfill-php82", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php82.git", @@ -1668,7 +1669,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.32.0" }, "funding": [ { @@ -1823,16 +1824,16 @@ }, { "name": "utopia-php/cache", - "version": "0.12.0", + "version": "0.13.1", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "646038f1d470b759c129348be8fc14da3c00bbd9" + "reference": "97220cb3b3822b166ee016d1646e2ae2815dc540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/646038f1d470b759c129348be8fc14da3c00bbd9", - "reference": "646038f1d470b759c129348be8fc14da3c00bbd9", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/97220cb3b3822b166ee016d1646e2ae2815dc540", + "reference": "97220cb3b3822b166ee016d1646e2ae2815dc540", "shasum": "" }, "require": { @@ -1840,6 +1841,7 @@ "ext-memcached": "*", "ext-redis": "*", "php": ">=8.0", + "utopia-php/pools": "0.8.*", "utopia-php/telemetry": "0.1.*" }, "require-dev": { @@ -1868,9 +1870,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.12.0" + "source": "https://github.com/utopia-php/cache/tree/0.13.1" }, - "time": "2025-02-25T09:09:21+00:00" + "time": "2025-05-09T14:43:52+00:00" }, { "name": "utopia-php/compression", @@ -1920,23 +1922,23 @@ }, { "name": "utopia-php/database", - "version": "0.64.2", + "version": "dev-feat-internal-to-sequence", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "dc9c4a68c93e8bea2dfaa76d1ba308be539998bd" + "reference": "0f3617e23bef7c6f260d7f8f194031c2f096a154" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/dc9c4a68c93e8bea2dfaa76d1ba308be539998bd", - "reference": "dc9c4a68c93e8bea2dfaa76d1ba308be539998bd", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0f3617e23bef7c6f260d7f8f194031c2f096a154", + "reference": "0f3617e23bef7c6f260d7f8f194031c2f096a154", "shasum": "" }, "require": { "ext-mbstring": "*", "ext-pdo": "*", "php": ">=8.1", - "utopia-php/cache": "0.12.*", + "utopia-php/cache": "0.13.*", "utopia-php/framework": "0.33.*", "utopia-php/pools": "0.8.*" }, @@ -1970,9 +1972,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.64.2" + "source": "https://github.com/utopia-php/database/tree/feat-internal-to-sequence" }, - "time": "2025-04-09T07:53:05+00:00" + "time": "2025-05-22T13:09:40+00:00" }, { "name": "utopia-php/dsn", @@ -2023,16 +2025,16 @@ }, { "name": "utopia-php/framework", - "version": "0.33.19", + "version": "0.33.20", "source": { "type": "git", "url": "https://github.com/utopia-php/http.git", - "reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0" + "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/http/zipball/64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0", - "reference": "64c7b7bb8a8595ffe875fa8d4b7705684dbf46c0", + "url": "https://api.github.com/repos/utopia-php/http/zipball/e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", + "reference": "e1c7ab4e0b5b0a9a70256b1e00912e101e76a131", "shasum": "" }, "require": { @@ -2064,22 +2066,22 @@ ], "support": { "issues": "https://github.com/utopia-php/http/issues", - "source": "https://github.com/utopia-php/http/tree/0.33.19" + "source": "https://github.com/utopia-php/http/tree/0.33.20" }, - "time": "2025-03-06T11:37:49+00:00" + "time": "2025-05-18T23:51:21+00:00" }, { "name": "utopia-php/pools", - "version": "0.8.0", + "version": "0.8.2", "source": { "type": "git", "url": "https://github.com/utopia-php/pools.git", - "reference": "60733929dc328e7ea47e800579c8bbf0d49df5ba" + "reference": "05c67aba42eb68ac65489cc1e7fc5db83db2dd4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/pools/zipball/60733929dc328e7ea47e800579c8bbf0d49df5ba", - "reference": "60733929dc328e7ea47e800579c8bbf0d49df5ba", + "url": "https://api.github.com/repos/utopia-php/pools/zipball/05c67aba42eb68ac65489cc1e7fc5db83db2dd4d", + "reference": "05c67aba42eb68ac65489cc1e7fc5db83db2dd4d", "shasum": "" }, "require": { @@ -2116,22 +2118,22 @@ ], "support": { "issues": "https://github.com/utopia-php/pools/issues", - "source": "https://github.com/utopia-php/pools/tree/0.8.0" + "source": "https://github.com/utopia-php/pools/tree/0.8.2" }, - "time": "2025-03-19T10:22:03+00:00" + "time": "2025-04-17T02:04:54+00:00" }, { "name": "utopia-php/storage", - "version": "0.18.10", + "version": "0.18.12", "source": { "type": "git", "url": "https://github.com/utopia-php/storage.git", - "reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e" + "reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/storage/zipball/76f31158f4251abb207f7a9b16f7cb0bfdb3b39e", - "reference": "76f31158f4251abb207f7a9b16f7cb0bfdb3b39e", + "url": "https://api.github.com/repos/utopia-php/storage/zipball/9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97", + "reference": "9a2556c39b5f4d9f8e79111fd34ec889b7bb1e97", "shasum": "" }, "require": { @@ -2144,9 +2146,10 @@ "ext-xz": "*", "ext-zlib": "*", "ext-zstd": "*", - "php": ">=8.0", + "php": ">=8.1", "utopia-php/framework": "0.*.*", - "utopia-php/system": "0.*.*" + "utopia-php/system": "0.*.*", + "utopia-php/telemetry": "0.1.*" }, "require-dev": { "laravel/pint": "1.2.*", @@ -2173,9 +2176,9 @@ ], "support": { "issues": "https://github.com/utopia-php/storage/issues", - "source": "https://github.com/utopia-php/storage/tree/0.18.10" + "source": "https://github.com/utopia-php/storage/tree/0.18.12" }, - "time": "2025-03-03T10:47:54+00:00" + "time": "2025-05-15T07:55:58+00:00" }, { "name": "utopia-php/system", @@ -2349,16 +2352,16 @@ }, { "name": "laravel/pint", - "version": "v1.22.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36" + "reference": "941d1927c5ca420c22710e98420287169c7bcaf7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", - "reference": "7ddfaa6523a675fae5c4123ee38fc6bfb8ee4f36", + "url": "https://api.github.com/repos/laravel/pint/zipball/941d1927c5ca420c22710e98420287169c7bcaf7", + "reference": "941d1927c5ca420c22710e98420287169c7bcaf7", "shasum": "" }, "require": { @@ -2370,11 +2373,11 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.75.0", - "illuminate/view": "^11.44.2", - "larastan/larastan": "^3.3.1", + "illuminate/view": "^11.44.7", + "larastan/larastan": "^3.4.0", "laravel-zero/framework": "^11.36.1", "mockery/mockery": "^1.6.12", - "nunomaduro/termwind": "^2.3", + "nunomaduro/termwind": "^2.3.1", "pestphp/pest": "^2.36.0" }, "bin": [ @@ -2411,20 +2414,20 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2025-04-08T22:11:45+00:00" + "time": "2025-05-08T08:38:12+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.13.0", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/024473a478be9df5fdaca2c793f2232fe788e414", - "reference": "024473a478be9df5fdaca2c793f2232fe788e414", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -2463,7 +2466,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -2471,7 +2474,7 @@ "type": "tidelift" } ], - "time": "2025-02-12T12:17:51+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "nikic/php-parser", @@ -2726,16 +2729,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.23", + "version": "1.12.27", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "29201e7a743a6ab36f91394eab51889a82631428" + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/29201e7a743a6ab36f91394eab51889a82631428", - "reference": "29201e7a743a6ab36f91394eab51889a82631428", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a6e423c076ab39dfedc307e2ac627ef579db162", + "reference": "3a6e423c076ab39dfedc307e2ac627ef579db162", "shasum": "" }, "require": { @@ -2780,7 +2783,7 @@ "type": "github" } ], - "time": "2025-03-23T14:57:32+00:00" + "time": "2025-05-21T20:51:45+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3107,16 +3110,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.17", + "version": "11.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c" + "reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fd2e863a2995cdfd864fb514b5e0b28b09895b5c", - "reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d565e2cdc21a7db9dc6c399c1fc2083b8010f289", + "reference": "d565e2cdc21a7db9dc6c399c1fc2083b8010f289", "shasum": "" }, "require": { @@ -3126,7 +3129,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.0", + "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.2", @@ -3139,7 +3142,7 @@ "sebastian/code-unit": "^3.0.3", "sebastian/comparator": "^6.3.1", "sebastian/diff": "^6.0.2", - "sebastian/environment": "^7.2.0", + "sebastian/environment": "^7.2.1", "sebastian/exporter": "^6.3.0", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", @@ -3188,7 +3191,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.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.21" }, "funding": [ { @@ -3199,12 +3202,20 @@ "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/phpunit", "type": "tidelift" } ], - "time": "2025-04-08T07:59:11+00:00" + "time": "2025-05-21T12:35:00+00:00" }, { "name": "sebastian/cli-parser", @@ -3583,23 +3594,23 @@ }, { "name": "sebastian/environment", - "version": "7.2.0", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.3" }, "suggest": { "ext-posix": "*" @@ -3635,15 +3646,27 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.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/sebastian/environment", + "type": "tidelift" } ], - "time": "2024-07-03T04:54:44+00:00" + "time": "2025-05-21T11:55:47+00:00" }, { "name": "sebastian/exporter", @@ -4186,7 +4209,7 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -4245,7 +4268,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.32.0" }, "funding": [ { @@ -4265,16 +4288,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { @@ -4325,7 +4348,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" }, "funding": [ { @@ -4341,7 +4364,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "theseer/tokenizer", @@ -4444,16 +4467,16 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.1", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", - "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af", + "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af", "shasum": "" }, "require": { @@ -4512,7 +4535,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2" }, "funding": [ { @@ -4524,12 +4547,21 @@ "type": "tidelift" } ], - "time": "2024-07-20T21:52:34+00:00" + "time": "2025-04-30T23:37:27+00:00" + } + ], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-feat-internal-to-sequence", + "alias": "0.65.5", + "alias_normalized": "0.65.5.0" } ], - "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/Migration/Cache.php b/src/Migration/Cache.php index f64a6ea8..7befd48c 100644 --- a/src/Migration/Cache.php +++ b/src/Migration/Cache.php @@ -30,18 +30,18 @@ public function __construct() */ public function add(Resource $resource): void { - if (! $resource->getInternalId()) { + if (! $resource->getSequence()) { $resourceId = uniqid(); if (isset($this->cache[$resource->getName()][$resourceId])) { $resourceId = uniqid(); // todo: $resourceId is not used? } - $resource->setInternalId(uniqid()); + $resource->setSequence(uniqid()); } if ($resource->getName() == Resource::TYPE_DOCUMENT) { $status = $resource->getStatus(); - $documentId = $resource->getInternalId(); + $documentId = $resource->getSequence(); $this->cache[$resource->getName()][$documentId] = $status; return; } @@ -51,7 +51,7 @@ public function add(Resource $resource): void $resource->setData(''); // Prevent Memory Leak } - $this->cache[$resource->getName()][$resource->getInternalId()] = $resource; + $this->cache[$resource->getName()][$resource->getSequence()] = $resource; } /** @@ -80,7 +80,7 @@ public function update(Resource $resource): void { // if documents then updating the status counter only if ($resource->getName() == Resource::TYPE_DOCUMENT) { - $documentId = $resource->getInternalId(); + $documentId = $resource->getSequence(); if (!isset($this->cache[$resource->getName()][$documentId])) { $this->add($resource); } else { @@ -94,7 +94,7 @@ public function update(Resource $resource): void $this->add($resource); } - $this->cache[$resource->getName()][$resource->getInternalId()] = $resource; + $this->cache[$resource->getName()][$resource->getSequence()] = $resource; } /** @@ -120,7 +120,7 @@ public function updateAll(array $resources): void public function remove(Resource $resource): void { if ($resource->getName() === Resource::TYPE_DOCUMENT) { - if (! isset($this->cache[$resource->getName()][$resource->getInternalId()])) { + if (! isset($this->cache[$resource->getName()][$resource->getSequence()])) { throw new \Exception('Resource does not exist in cache'); } } @@ -128,7 +128,7 @@ public function remove(Resource $resource): void throw new \Exception('Resource does not exist in cache'); } - unset($this->cache[$resource->getName()][$resource->getInternalId()]); + unset($this->cache[$resource->getName()][$resource->getSequence()]); } /** diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index 94d44193..10612740 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -332,7 +332,7 @@ protected function createDatabase(Database $resource): bool 'originalId' => empty($resource->getOriginalId()) ? null : $resource->getOriginalId(), ])); - $resource->setInternalId($database->getInternalId()); + $resource->setSequence($database->getSequence()); $attributes = \array_map( fn ($attr) => new UtopiaDocument($attr), @@ -344,7 +344,7 @@ protected function createDatabase(Database $resource): bool ); $this->database->createCollection( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $attributes, $indexes ); @@ -389,9 +389,9 @@ protected function createCollection(Collection $resource): bool ); } - $collection = $this->database->createDocument('database_' . $database->getInternalId(), new UtopiaDocument([ + $collection = $this->database->createDocument('database_' . $database->getSequence(), new UtopiaDocument([ '$id' => $resource->getId(), - 'databaseInternalId' => $database->getInternalId(), + 'databaseInternalId' => $database->getSequence(), 'databaseId' => $resource->getDatabase()->getId(), '$permissions' => Permission::aggregate($resource->getPermissions()), 'documentSecurity' => $resource->getDocumentSecurity(), @@ -402,10 +402,10 @@ protected function createCollection(Collection $resource): bool '$updatedAt' => $resource->getUpdatedAt(), ])); - $resource->setInternalId($collection->getInternalId()); + $resource->setSequence($collection->getSequence()); $this->database->createCollection( - 'database_' . $database->getInternalId() . '_collection_' . $resource->getInternalId(), + 'database_' . $database->getSequence() . '_collection_' . $resource->getSequence(), permissions: $resource->getPermissions(), documentSecurity: $resource->getDocumentSecurity() ); @@ -449,7 +449,7 @@ protected function createAttribute(Attribute $resource): bool } $collection = $this->database->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getCollection()->getId(), ); @@ -491,7 +491,7 @@ protected function createAttribute(Attribute $resource): bool if ($type === UtopiaDatabase::VAR_RELATIONSHIP) { $resource->getOptions()['side'] = UtopiaDatabase::RELATION_SIDE_PARENT; $relatedCollection = $this->database->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getOptions()['relatedCollection'] ); if ($relatedCollection->isEmpty()) { @@ -506,11 +506,11 @@ protected function createAttribute(Attribute $resource): bool try { $attribute = new UtopiaDocument([ - '$id' => ID::custom($database->getInternalId() . '_' . $collection->getInternalId() . '_' . $resource->getKey()), + '$id' => ID::custom($database->getSequence() . '_' . $collection->getSequence() . '_' . $resource->getKey()), 'key' => $resource->getKey(), - 'databaseInternalId' => $database->getInternalId(), + 'databaseInternalId' => $database->getSequence(), 'databaseId' => $database->getId(), - 'collectionInternalId' => $collection->getInternalId(), + 'collectionInternalId' => $collection->getSequence(), 'collectionId' => $collection->getId(), 'type' => $type, 'status' => 'available', @@ -545,13 +545,13 @@ protected function createAttribute(Attribute $resource): bool message: 'Attribute limit exceeded', ); } catch (\Throwable $e) { - $this->database->purgeCachedDocument('database_' . $database->getInternalId(), $collection->getId()); - $this->database->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId()); + $this->database->purgeCachedDocument('database_' . $database->getSequence(), $collection->getId()); + $this->database->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); throw $e; } - $this->database->purgeCachedDocument('database_' . $database->getInternalId(), $collection->getId()); - $this->database->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId()); + $this->database->purgeCachedDocument('database_' . $database->getSequence(), $collection->getId()); + $this->database->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); $options = $resource->getOptions(); $twoWayKey = null; @@ -564,11 +564,11 @@ protected function createAttribute(Attribute $resource): bool try { $twoWayAttribute = new UtopiaDocument([ - '$id' => ID::custom($database->getInternalId() . '_' . $relatedCollection->getInternalId() . '_' . $twoWayKey), + '$id' => ID::custom($database->getSequence() . '_' . $relatedCollection->getSequence() . '_' . $twoWayKey), 'key' => $twoWayKey, - 'databaseInternalId' => $database->getInternalId(), + 'databaseInternalId' => $database->getSequence(), 'databaseId' => $database->getId(), - 'collectionInternalId' => $relatedCollection->getInternalId(), + 'collectionInternalId' => $relatedCollection->getSequence(), 'collectionId' => $relatedCollection->getId(), 'type' => $type, 'status' => 'available', @@ -605,8 +605,8 @@ protected function createAttribute(Attribute $resource): bool message: 'Attribute limit exceeded', ); } catch (\Throwable $e) { - $this->database->purgeCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId()); - $this->database->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId()); + $this->database->purgeCachedDocument('database_' . $database->getSequence(), $relatedCollection->getId()); + $this->database->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence()); throw $e; } } @@ -615,8 +615,8 @@ protected function createAttribute(Attribute $resource): bool switch ($type) { case UtopiaDatabase::VAR_RELATIONSHIP: if (!$this->database->createRelationship( - collection: 'database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), - relatedCollection: 'database_' . $database->getInternalId() . '_collection_' . $relatedCollection->getInternalId(), + collection: 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), + relatedCollection: 'database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence(), type: $options['relationType'], twoWay: $options['twoWay'], id: $resource->getKey(), @@ -633,7 +633,7 @@ protected function createAttribute(Attribute $resource): bool break; default: if (!$this->database->createAttribute( - 'database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), + 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $resource->getKey(), $type, $resource->getSize(), @@ -664,11 +664,11 @@ protected function createAttribute(Attribute $resource): bool } if ($type === UtopiaDatabase::VAR_RELATIONSHIP && $options['twoWay']) { - $this->database->purgeCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId()); + $this->database->purgeCachedDocument('database_' . $database->getSequence(), $relatedCollection->getId()); } - $this->database->purgeCachedDocument('database_' . $database->getInternalId(), $collection->getId()); - $this->database->purgeCachedCollection('database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId()); + $this->database->purgeCachedDocument('database_' . $database->getSequence(), $collection->getId()); + $this->database->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); return true; } @@ -693,7 +693,7 @@ protected function createIndex(Index $resource): bool } $collection = $this->database->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getCollection()->getId(), ); if ($collection->isEmpty()) { @@ -706,8 +706,8 @@ protected function createIndex(Index $resource): bool } $count = $this->database->count('indexes', [ - Query::equal('collectionInternalId', [$collection->getInternalId()]), - Query::equal('databaseInternalId', [$database->getInternalId()]) + Query::equal('collectionInternalId', [$collection->getSequence()]), + Query::equal('databaseInternalId', [$database->getSequence()]) ], $this->database->getLimitForIndexes()); if ($count >= $this->database->getLimitForIndexes()) { @@ -810,12 +810,12 @@ protected function createIndex(Index $resource): bool } $index = new UtopiaDocument([ - '$id' => ID::custom($database->getInternalId() . '_' . $collection->getInternalId() . '_' . $resource->getKey()), + '$id' => ID::custom($database->getSequence() . '_' . $collection->getSequence() . '_' . $resource->getKey()), 'key' => $resource->getKey(), 'status' => 'available', // processing, available, failed, deleting, stuck - 'databaseInternalId' => $database->getInternalId(), + 'databaseInternalId' => $database->getSequence(), 'databaseId' => $database->getId(), - 'collectionInternalId' => $collection->getInternalId(), + 'collectionInternalId' => $collection->getSequence(), 'collectionId' => $collection->getId(), 'type' => $resource->getType(), 'attributes' => $resource->getAttributes(), @@ -844,7 +844,7 @@ protected function createIndex(Index $resource): bool try { $result = $this->database->createIndex( - 'database_' . $database->getInternalId() . '_collection_' . $collection->getInternalId(), + 'database_' . $database->getSequence() . '_collection_' . $collection->getSequence(), $resource->getKey(), $resource->getType(), $resource->getAttributes(), @@ -872,7 +872,7 @@ protected function createIndex(Index $resource): bool } $this->database->purgeCachedDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $collection->getId() ); @@ -928,12 +928,12 @@ protected function createDocument(Document $resource, bool $isLast): bool $resource->getCollection()->getDatabase()->getId(), ); $collection = $this->database->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getCollection()->getId(), ); - $databaseInternalId = $database->getInternalId(); - $collectionInternalId = $collection->getInternalId(); + $databaseInternalId = $database->getSequence(); + $collectionInternalId = $collection->getSequence(); /** * This is in case an attribute was deleted from Appwrite attributes collection but was not deleted from the table diff --git a/src/Migration/Resource.php b/src/Migration/Resource.php index c92de1ed..32af0e79 100644 --- a/src/Migration/Resource.php +++ b/src/Migration/Resource.php @@ -75,7 +75,7 @@ abstract class Resource implements \JsonSerializable protected string $originalId = ''; - protected string $internalId = ''; + protected string $sequence = ''; protected string $createdAt = ''; protected string $updatedAt = ''; @@ -117,14 +117,14 @@ public function setOriginalId(string $originalId): self return $this; } - public function getInternalId(): string + public function getSequence(): string { - return $this->internalId; + return $this->sequence; } - public function setInternalId(string $internalId): self + public function setSequence(string $sequence): self { - $this->internalId = $internalId; + $this->sequence = $sequence; return $this; } diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index 204413df..fd026f14 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -1407,7 +1407,7 @@ private function exportDeploymentData(Func $func, array $deployment): void $file, $deployment['activate'] ); - $deployment->setInternalId($deployment->getId()); + $deployment->setSequence($deployment->getId()); $this->callback([$deployment]); @@ -1427,13 +1427,13 @@ private function exportDeploymentData(Func $func, array $deployment): void $deployment['activate'] ); - $deployment->setInternalId($deployment->getId()); + $deployment->setSequence($deployment->getId()); // Loop until the entire file is downloaded while ($start < $fileSize) { $chunkData = $this->call( 'GET', - "/functions/{$func->getId()}/deployments/{$deployment->getInternalId()}/download", + "/functions/{$func->getId()}/deployments/{$deployment->getSequence()}/download", ['range' => "bytes=$start-$end"] ); diff --git a/src/Migration/Sources/Appwrite/Reader/Database.php b/src/Migration/Sources/Appwrite/Reader/Database.php index 6da1944a..c7634b3c 100644 --- a/src/Migration/Sources/Appwrite/Reader/Database.php +++ b/src/Migration/Sources/Appwrite/Reader/Database.php @@ -34,7 +34,7 @@ public function report(array $resources, array &$report): void $report[Resource::TYPE_COLLECTION] = 0; $databases = $this->listDatabases(); foreach ($databases as $database) { - $collectionId = "database_{$database->getInternalId()}"; + $collectionId = "database_{$database->getSequence()}"; $report[Resource::TYPE_COLLECTION] += $this->countResources($collectionId); } @@ -54,7 +54,7 @@ public function report(array $resources, array &$report): void $collections = $this->listCollections($dbResource); foreach ($collections as $collection) { - $collectionId = "database_{$database->getInternalId()}_collection_{$collection->getInternalId()}"; + $collectionId = "database_{$database->getSequence()}_collection_{$collection->getSequence()}"; $report[Resource::TYPE_DOCUMENT] += $this->countResources($collectionId); } @@ -76,8 +76,8 @@ public function report(array $resources, array &$report): void foreach ($collections as $collection) { $report[Resource::TYPE_ATTRIBUTE] += $this->countResources('attributes', [ - Query::equal('databaseInternalId', [$database->getInternalId()]), - Query::equal('collectionInternalId', [$collection->getInternalId()]), + Query::equal('databaseInternalId', [$database->getSequence()]), + Query::equal('collectionInternalId', [$collection->getSequence()]), ]); } } @@ -98,8 +98,8 @@ public function report(array $resources, array &$report): void foreach ($collections as $collection) { $report[Resource::TYPE_INDEX] += $this->countResources('indexes', [ - Query::equal('databaseInternalId', [$database->getInternalId()]), - Query::equal('collectionInternalId', [$collection->getInternalId()]), + Query::equal('databaseInternalId', [$database->getSequence()]), + Query::equal('collectionInternalId', [$collection->getSequence()]), ]); } } @@ -137,7 +137,7 @@ public function listCollections(DatabaseResource $resource, array $queries = []) try { return $this->dbForProject->find( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $queries ); } catch (DatabaseException $e) { @@ -169,7 +169,7 @@ public function listAttributes(CollectionResource $resource, array $queries = [] } $collection = $this->dbForProject->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getId(), ); @@ -182,8 +182,8 @@ public function listAttributes(CollectionResource $resource, array $queries = [] ); } - $queries[] = Query::equal('databaseInternalId', [$database->getInternalId()]); - $queries[] = Query::equal('collectionInternalId', [$collection->getInternalId()]); + $queries[] = Query::equal('databaseInternalId', [$database->getSequence()]); + $queries[] = Query::equal('collectionInternalId', [$collection->getSequence()]); try { $attributes = $this->dbForProject->find('attributes', $queries); @@ -231,7 +231,7 @@ public function listIndexes(CollectionResource $resource, array $queries = []): } $collection = $this->dbForProject->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getId(), ); @@ -244,8 +244,8 @@ public function listIndexes(CollectionResource $resource, array $queries = []): ); } - $queries[] = Query::equal('databaseInternalId', [$database->getInternalId()]); - $queries[] = Query::equal('collectionInternalId', [$collection->getInternalId()]); + $queries[] = Query::equal('databaseInternalId', [$database->getSequence()]); + $queries[] = Query::equal('collectionInternalId', [$collection->getSequence()]); try { return $this->dbForProject->find('indexes', $queries); @@ -278,7 +278,7 @@ public function listDocuments(CollectionResource $resource, array $queries = []) } $collection = $this->dbForProject->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getId(), ); @@ -291,7 +291,7 @@ public function listDocuments(CollectionResource $resource, array $queries = []) ); } - $collectionId = "database_{$database->getInternalId()}_collection_{$collection->getInternalId()}"; + $collectionId = "database_{$database->getSequence()}_collection_{$collection->getSequence()}"; try { $documents = $this->dbForProject->find($collectionId, $queries); @@ -328,7 +328,7 @@ public function getDocument(CollectionResource $resource, string $documentId, ar } $collection = $this->dbForProject->getDocument( - 'database_' . $database->getInternalId(), + 'database_' . $database->getSequence(), $resource->getId(), ); @@ -341,7 +341,7 @@ public function getDocument(CollectionResource $resource, string $documentId, ar ); } - $collectionId = "database_{$database->getInternalId()}_collection_{$collection->getInternalId()}"; + $collectionId = "database_{$database->getSequence()}_collection_{$collection->getSequence()}"; return $this->dbForProject->getDocument( $collectionId, @@ -387,7 +387,7 @@ public function queryCursorAfter(mixed $resource): Query break; case CollectionResource::class: $database = $this->dbForProject->getDocument('databases', $resource->getDatabase()->getId()); - $document = $this->dbForProject->getDocument('database_' . $database->getInternalId(), $resource->getId()); + $document = $this->dbForProject->getDocument('database_' . $database->getSequence(), $resource->getId()); break; case AttributeResource::class: $document = $this->dbForProject->getDocument('attributes', $resource->getId()); From e0ca6474b1cf529246a8782208667d7d712282aa Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 23 May 2025 19:34:28 +1200 Subject: [PATCH 2/3] Update database --- composer.json | 2 +- composer.lock | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index dfe85fb3..28bc8f6f 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-curl": "*", "ext-openssl": "*", "appwrite/appwrite": "11.*", - "utopia-php/database": "dev-feat-internal-to-sequence as 0.65.5", + "utopia-php/database": "0.71.*", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*" diff --git a/composer.lock b/composer.lock index 29f4b5d2..1c86c225 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": "7def39bcfecbe7a58ebb612527d5b7f5", + "content-hash": "96168d83e7f4bc9207d7ed55a9731f8a", "packages": [ { "name": "appwrite/appwrite", @@ -1922,16 +1922,16 @@ }, { "name": "utopia-php/database", - "version": "dev-feat-internal-to-sequence", + "version": "0.71.0", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "0f3617e23bef7c6f260d7f8f194031c2f096a154" + "reference": "cf463c0a5c64a4168fe56266ace4ae835d61c920" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/0f3617e23bef7c6f260d7f8f194031c2f096a154", - "reference": "0f3617e23bef7c6f260d7f8f194031c2f096a154", + "url": "https://api.github.com/repos/utopia-php/database/zipball/cf463c0a5c64a4168fe56266ace4ae835d61c920", + "reference": "cf463c0a5c64a4168fe56266ace4ae835d61c920", "shasum": "" }, "require": { @@ -1972,9 +1972,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/feat-internal-to-sequence" + "source": "https://github.com/utopia-php/database/tree/0.71.0" }, - "time": "2025-05-22T13:09:40+00:00" + "time": "2025-05-23T07:32:59+00:00" }, { "name": "utopia-php/dsn", @@ -4550,18 +4550,9 @@ "time": "2025-04-30T23:37:27+00:00" } ], - "aliases": [ - { - "package": "utopia-php/database", - "version": "dev-feat-internal-to-sequence", - "alias": "0.65.5", - "alias_normalized": "0.65.5.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/database": 20 - }, + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { From 7a2b3b8b50dcde455a133678a6f2e3eed9afbc36 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 23 May 2025 19:37:27 +1200 Subject: [PATCH 3/3] No pin --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 28bc8f6f..4405cf7c 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-curl": "*", "ext-openssl": "*", "appwrite/appwrite": "11.*", - "utopia-php/database": "0.71.*", + "utopia-php/database": "0.*.*", "utopia-php/storage": "0.18.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*" diff --git a/composer.lock b/composer.lock index 1c86c225..f572dc1d 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": "96168d83e7f4bc9207d7ed55a9731f8a", + "content-hash": "debf6e30f1e56bf0f792191a28277302", "packages": [ { "name": "appwrite/appwrite",