This commit is contained in:
ArnabChatterjee20k committed 2026-05-05 19:14:06 +05:30
commit d2d36e9ad9
23 files changed
+1508 -233

No files matched your search

+2 -2
View File
@@ -26,8 +26,8 @@
"ext-curl": "*",
"ext-openssl": "*",
"appwrite/appwrite": "19.*",
"utopia-php/database": "dev-big-init as 5.4",
"utopia-php/storage": "1.0.*",
"utopia-php/database": "dev-big-init as 5.77",
"utopia-php/storage": "2.*",
"utopia-php/dsn": "0.2.*",
"halaxa/json-machine": "^1.2"
},
Generated
+135 -136
View File
@@ -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": "16a5b9e9382b5fa55ea40c8ec5a9cc00",
"content-hash": "ae396ad0e75429f13de6f2891f3cfae3",
"packages": [
{
"name": "appwrite/appwrite",
@@ -187,23 +187,23 @@
},
{
"name": "google/protobuf",
"version": "v4.33.5",
"version": "v4.33.6",
"source": {
"type": "git",
"url": "https://github.com/protocolbuffers/protobuf-php.git",
"reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d"
"reference": "84b008c23915ed94536737eae46f41ba3bccfe67"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d",
"reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d",
"url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/84b008c23915ed94536737eae46f41ba3bccfe67",
"reference": "84b008c23915ed94536737eae46f41ba3bccfe67",
"shasum": ""
},
"require": {
"php": ">=8.1.0"
},
"require-dev": {
"phpunit/phpunit": ">=5.0.0 <8.5.27"
"phpunit/phpunit": ">=10.5.62 <11.0.0"
},
"suggest": {
"ext-bcmath": "Need to support JSON deserialization"
@@ -225,9 +225,9 @@
"proto"
],
"support": {
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.5"
"source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.6"
},
"time": "2026-01-29T20:49:00+00:00"
"time": "2026-03-18T17:32:05+00:00"
},
{
"name": "halaxa/json-machine",
@@ -514,16 +514,16 @@
},
{
"name": "open-telemetry/api",
"version": "1.8.0",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/api.git",
"reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad"
"reference": "6f8d237ce2c304ca85f31970f788e7f074d147be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/df5197c6fd0ddd8e9883b87de042d9341300e2ad",
"reference": "df5197c6fd0ddd8e9883b87de042d9341300e2ad",
"url": "https://api.github.com/repos/opentelemetry-php/api/zipball/6f8d237ce2c304ca85f31970f788e7f074d147be",
"reference": "6f8d237ce2c304ca85f31970f788e7f074d147be",
"shasum": ""
},
"require": {
@@ -580,20 +580,20 @@
"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-02-25T13:24:05+00:00"
},
{
"name": "open-telemetry/context",
"version": "1.4.0",
"version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/context.git",
"reference": "d4c4470b541ce72000d18c339cfee633e4c8e0cf"
"reference": "3c414b246e0dabb7d6145404e6a5e4536ca18d07"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/context/zipball/d4c4470b541ce72000d18c339cfee633e4c8e0cf",
"reference": "d4c4470b541ce72000d18c339cfee633e4c8e0cf",
"url": "https://api.github.com/repos/opentelemetry-php/context/zipball/3c414b246e0dabb7d6145404e6a5e4536ca18d07",
"reference": "3c414b246e0dabb7d6145404e6a5e4536ca18d07",
"shasum": ""
},
"require": {
@@ -635,11 +635,11 @@
],
"support": {
"chat": "https://app.slack.com/client/T08PSQ7BQ/C01NFPCV44V",
"docs": "https://opentelemetry.io/docs/php",
"docs": "https://opentelemetry.io/docs/languages/php",
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2025-09-19T00:05:49+00:00"
"time": "2025-10-19T06:44:33+00:00"
},
{
"name": "open-telemetry/exporter-otlp",
@@ -707,16 +707,16 @@
},
{
"name": "open-telemetry/gen-otlp-protobuf",
"version": "1.8.0",
"version": "1.9.0",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/gen-otlp-protobuf.git",
"reference": "673af5b06545b513466081884b47ef15a536edde"
"reference": "a229cf161d42001d64c8f21e8f678581fe1c66b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/673af5b06545b513466081884b47ef15a536edde",
"reference": "673af5b06545b513466081884b47ef15a536edde",
"url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/a229cf161d42001d64c8f21e8f678581fe1c66b9",
"reference": "a229cf161d42001d64c8f21e8f678581fe1c66b9",
"shasum": ""
},
"require": {
@@ -762,30 +762,30 @@
],
"support": {
"chat": "https://app.slack.com/client/T08PSQ7BQ/C01NFPCV44V",
"docs": "https://opentelemetry.io/docs/php",
"docs": "https://opentelemetry.io/docs/languages/php",
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2025-09-17T23:10:12+00:00"
"time": "2025-10-19T06:44:33+00:00"
},
{
"name": "open-telemetry/sdk",
"version": "1.13.0",
"version": "1.14.0",
"source": {
"type": "git",
"url": "https://github.com/opentelemetry-php/sdk.git",
"reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1"
"reference": "6e3d0ce93e76555dd5e2f1d19443ff45b990e410"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/c76f91203bf7ef98ab3f4e0a82ca21699af185e1",
"reference": "c76f91203bf7ef98ab3f4e0a82ca21699af185e1",
"url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/6e3d0ce93e76555dd5e2f1d19443ff45b990e410",
"reference": "6e3d0ce93e76555dd5e2f1d19443ff45b990e410",
"shasum": ""
},
"require": {
"ext-json": "*",
"nyholm/psr7-server": "^1.1",
"open-telemetry/api": "^1.7",
"open-telemetry/api": "^1.8",
"open-telemetry/context": "^1.4",
"open-telemetry/sem-conv": "^1.0",
"php": "^8.1",
@@ -863,7 +863,7 @@
"issues": "https://github.com/open-telemetry/opentelemetry-php/issues",
"source": "https://github.com/open-telemetry/opentelemetry-php"
},
"time": "2026-01-28T11:38:11+00:00"
"time": "2026-03-21T11:50:01+00:00"
},
{
"name": "open-telemetry/sem-conv",
@@ -1487,16 +1487,16 @@
},
{
"name": "symfony/http-client",
"version": "v7.4.5",
"version": "v7.4.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-client.git",
"reference": "84bb634857a893cc146cceb467e31b3f02c5fe9f"
"reference": "01933e626c3de76bea1e22641e205e78f6a34342"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/84bb634857a893cc146cceb467e31b3f02c5fe9f",
"reference": "84bb634857a893cc146cceb467e31b3f02c5fe9f",
"url": "https://api.github.com/repos/symfony/http-client/zipball/01933e626c3de76bea1e22641e205e78f6a34342",
"reference": "01933e626c3de76bea1e22641e205e78f6a34342",
"shasum": ""
},
"require": {
@@ -1564,7 +1564,7 @@
"http"
],
"support": {
"source": "https://github.com/symfony/http-client/tree/v7.4.5"
"source": "https://github.com/symfony/http-client/tree/v7.4.8"
},
"funding": [
{
@@ -1584,7 +1584,7 @@
"type": "tidelift"
}
],
"time": "2026-01-27T16:16:02+00:00"
"time": "2026-03-30T12:55:43+00:00"
},
{
"name": "symfony/http-client-contracts",
@@ -1666,16 +1666,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493"
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493",
"reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315",
"reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315",
"shasum": ""
},
"require": {
@@ -1727,7 +1727,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0"
},
"funding": [
{
@@ -1747,20 +1747,20 @@
"type": "tidelift"
}
],
"time": "2024-12-23T08:48:59+00:00"
"time": "2026-04-10T17:25:58+00:00"
},
{
"name": "symfony/polyfill-php82",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php82.git",
"reference": "5d2ed36f7734637dacc025f179698031951b1692"
"reference": "34808efe3e68f69685796f7c253a2f1d8ea9df59"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692",
"reference": "5d2ed36f7734637dacc025f179698031951b1692",
"url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/34808efe3e68f69685796f7c253a2f1d8ea9df59",
"reference": "34808efe3e68f69685796f7c253a2f1d8ea9df59",
"shasum": ""
},
"require": {
@@ -1807,7 +1807,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php82/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-php82/tree/v1.37.0"
},
"funding": [
{
@@ -1827,20 +1827,20 @@
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-php83",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php83.git",
"reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5"
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5",
"reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/3600c2cb22399e25bb226e4a135ce91eeb2a6149",
"reference": "3600c2cb22399e25bb226e4a135ce91eeb2a6149",
"shasum": ""
},
"require": {
@@ -1887,7 +1887,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php83/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-php83/tree/v1.37.0"
},
"funding": [
{
@@ -1907,20 +1907,20 @@
"type": "tidelift"
}
],
"time": "2025-07-08T02:45:35+00:00"
"time": "2026-04-10T17:25:58+00:00"
},
{
"name": "symfony/polyfill-php85",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php85.git",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91"
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"reference": "d4e5fcd4ab3d998ab16c0db48e6cbb9a01993f91",
"url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee",
"reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee",
"shasum": ""
},
"require": {
@@ -1967,7 +1967,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php85/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0"
},
"funding": [
{
@@ -1987,7 +1987,7 @@
"type": "tidelift"
}
],
"time": "2025-06-23T16:12:55+00:00"
"time": "2026-04-26T13:10:57+00:00"
},
{
"name": "symfony/service-contracts",
@@ -2130,16 +2130,16 @@
},
{
"name": "utopia-php/cache",
"version": "1.0.0",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/cache.git",
"reference": "7068870c086a6aea16173563a26b93ef3e408439"
"reference": "05ceba981436a4022553f7aaa2a05fa049d0f71c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/cache/zipball/7068870c086a6aea16173563a26b93ef3e408439",
"reference": "7068870c086a6aea16173563a26b93ef3e408439",
"url": "https://api.github.com/repos/utopia-php/cache/zipball/05ceba981436a4022553f7aaa2a05fa049d0f71c",
"reference": "05ceba981436a4022553f7aaa2a05fa049d0f71c",
"shasum": ""
},
"require": {
@@ -2176,9 +2176,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/cache/issues",
"source": "https://github.com/utopia-php/cache/tree/1.0.0"
"source": "https://github.com/utopia-php/cache/tree/1.0.1"
},
"time": "2026-01-28T10:55:44+00:00"
"time": "2026-03-12T03:39:09+00:00"
},
{
"name": "utopia-php/console",
@@ -2234,18 +2234,19 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9"
"reference": "ee8895a3ae835978fa4eb143619e4950e7001648"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ef5c77972a95129eb929cce6c8f7c674db930ec9",
"reference": "ef5c77972a95129eb929cce6c8f7c674db930ec9",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ee8895a3ae835978fa4eb143619e4950e7001648",
"reference": "ee8895a3ae835978fa4eb143619e4950e7001648",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-mongodb": "*",
"ext-pdo": "*",
"ext-redis": "*",
"php": ">=8.4",
"utopia-php/cache": "1.*",
"utopia-php/console": "0.1.*",
@@ -2285,7 +2286,7 @@
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/big-init"
},
"time": "2026-03-30T06:31:05+00:00"
"time": "2026-05-05T13:27:52+00:00"
},
{
"name": "utopia-php/dsn",
@@ -2336,16 +2337,16 @@
},
{
"name": "utopia-php/mongo",
"version": "1.0.0",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/mongo.git",
"reference": "45bedf36c2c946ec7a0a3e59b9f12f772de0b01d"
"reference": "73593682deee4696525a04e26524c1c1226e1530"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/mongo/zipball/45bedf36c2c946ec7a0a3e59b9f12f772de0b01d",
"reference": "45bedf36c2c946ec7a0a3e59b9f12f772de0b01d",
"url": "https://api.github.com/repos/utopia-php/mongo/zipball/73593682deee4696525a04e26524c1c1226e1530",
"reference": "73593682deee4696525a04e26524c1c1226e1530",
"shasum": ""
},
"require": {
@@ -2391,22 +2392,22 @@
],
"support": {
"issues": "https://github.com/utopia-php/mongo/issues",
"source": "https://github.com/utopia-php/mongo/tree/1.0.0"
"source": "https://github.com/utopia-php/mongo/tree/1.1.0"
},
"time": "2026-02-12T05:54:06+00:00"
"time": "2026-04-24T06:15:10+00:00"
},
{
"name": "utopia-php/pools",
"version": "1.0.2",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/pools.git",
"reference": "b7d8dd00306cdd8bf3ff6f1dc90caeaf27dabeb1"
"reference": "74de7c5457a2c447f27e7ec4d72e8412a7d68c10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/b7d8dd00306cdd8bf3ff6f1dc90caeaf27dabeb1",
"reference": "b7d8dd00306cdd8bf3ff6f1dc90caeaf27dabeb1",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/74de7c5457a2c447f27e7ec4d72e8412a7d68c10",
"reference": "74de7c5457a2c447f27e7ec4d72e8412a7d68c10",
"shasum": ""
},
"require": {
@@ -2444,22 +2445,22 @@
],
"support": {
"issues": "https://github.com/utopia-php/pools/issues",
"source": "https://github.com/utopia-php/pools/tree/1.0.2"
"source": "https://github.com/utopia-php/pools/tree/1.0.3"
},
"time": "2026-01-28T13:12:36+00:00"
"time": "2026-02-26T08:42:40+00:00"
},
{
"name": "utopia-php/storage",
"version": "1.0.0",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/storage.git",
"reference": "f672e8865938e5d1d6dc3bd149ceba4e5582199e"
"reference": "52d1f89a47165ef0d3deff63043cda182175adfb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/f672e8865938e5d1d6dc3bd149ceba4e5582199e",
"reference": "f672e8865938e5d1d6dc3bd149ceba4e5582199e",
"url": "https://api.github.com/repos/utopia-php/storage/zipball/52d1f89a47165ef0d3deff63043cda182175adfb",
"reference": "52d1f89a47165ef0d3deff63043cda182175adfb",
"shasum": ""
},
"require": {
@@ -2473,9 +2474,8 @@
"utopia-php/validators": "0.2.*"
},
"require-dev": {
"laravel/pint": "1.2.*",
"phpunit/phpunit": "^9.3",
"vimeo/psalm": "4.0.1"
"laravel/pint": "^1.21",
"phpunit/phpunit": "^9.3"
},
"type": "library",
"autoload": {
@@ -2497,22 +2497,22 @@
],
"support": {
"issues": "https://github.com/utopia-php/storage/issues",
"source": "https://github.com/utopia-php/storage/tree/1.0.0"
"source": "https://github.com/utopia-php/storage/tree/2.0.0"
},
"time": "2026-02-17T04:37:10+00:00"
"time": "2026-04-27T11:39:32+00:00"
},
{
"name": "utopia-php/system",
"version": "0.10.0",
"version": "0.10.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/system.git",
"reference": "6441a9c180958a373e5ddb330264dd638539dfdb"
"reference": "7c1669533bb9c285de19191270c8c1439161a78a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/system/zipball/6441a9c180958a373e5ddb330264dd638539dfdb",
"reference": "6441a9c180958a373e5ddb330264dd638539dfdb",
"url": "https://api.github.com/repos/utopia-php/system/zipball/7c1669533bb9c285de19191270c8c1439161a78a",
"reference": "7c1669533bb9c285de19191270c8c1439161a78a",
"shasum": ""
},
"require": {
@@ -2553,9 +2553,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/system/issues",
"source": "https://github.com/utopia-php/system/tree/0.10.0"
"source": "https://github.com/utopia-php/system/tree/0.10.1"
},
"time": "2025-10-15T19:12:00+00:00"
"time": "2026-03-15T21:07:41+00:00"
},
{
"name": "utopia-php/telemetry",
@@ -2723,16 +2723,16 @@
},
{
"name": "laravel/pint",
"version": "v1.27.1",
"version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5"
"reference": "e60e2112ee779ce60f253695b273d1646a17d6f1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/54cca2de13790570c7b6f0f94f37896bee4abcb5",
"reference": "54cca2de13790570c7b6f0f94f37896bee4abcb5",
"url": "https://api.github.com/repos/laravel/pint/zipball/e60e2112ee779ce60f253695b273d1646a17d6f1",
"reference": "e60e2112ee779ce60f253695b273d1646a17d6f1",
"shasum": ""
},
"require": {
@@ -2740,16 +2740,16 @@
"ext-mbstring": "*",
"ext-tokenizer": "*",
"ext-xml": "*",
"php": "^8.2.0"
"php": "^8.0"
},
"require-dev": {
"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.5"
"friendsofphp/php-cs-fixer": "^3.11.0",
"illuminate/view": "^9.32.0",
"laravel-zero/framework": "^9.2.0",
"mockery/mockery": "^1.5.1",
"nunomaduro/larastan": "^2.2.0",
"nunomaduro/termwind": "^1.14.0",
"pestphp/pest": "^1.22.1"
},
"bin": [
"builds/pint"
@@ -2775,7 +2775,6 @@
"description": "An opinionated code formatter for PHP.",
"homepage": "https://laravel.com",
"keywords": [
"dev",
"format",
"formatter",
"lint",
@@ -2786,7 +2785,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2026-02-10T20:00:20+00:00"
"time": "2022-11-29T16:25:20+00:00"
},
{
"name": "myclabs/deep-copy",
@@ -3101,11 +3100,11 @@
},
{
"name": "phpstan/phpstan",
"version": "1.12.32",
"version": "1.12.33",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8",
"reference": "2770dcdf5078d0b0d53f94317e06affe88419aa8",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/37982d6fc7cbb746dda7773530cda557cdf119e1",
"reference": "37982d6fc7cbb746dda7773530cda557cdf119e1",
"shasum": ""
},
"require": {
@@ -3150,7 +3149,7 @@
"type": "github"
}
],
"time": "2025-09-30T10:16:31+00:00"
"time": "2026-02-28T20:30:03+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -3501,16 +3500,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.5.53",
"version": "11.5.55",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a997a653a82845f1240d73ee73a8a4e97e4b0607"
"reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a997a653a82845f1240d73ee73a8a4e97e4b0607",
"reference": "a997a653a82845f1240d73ee73a8a4e97e4b0607",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/adc7262fccc12de2b30f12a8aa0b33775d814f00",
"reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00",
"shasum": ""
},
"require": {
@@ -3583,7 +3582,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.53"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.55"
},
"funding": [
{
@@ -3607,7 +3606,7 @@
"type": "tidelift"
}
],
"time": "2026-02-10T12:28:25+00:00"
"time": "2026-02-18T12:37:06+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -4649,16 +4648,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
"reference": "141046a8f9477948ff284fa65be2095baafb94f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2",
"reference": "141046a8f9477948ff284fa65be2095baafb94f2",
"shasum": ""
},
"require": {
@@ -4708,7 +4707,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0"
},
"funding": [
{
@@ -4728,20 +4727,20 @@
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2026-04-10T16:19:22+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.33.0",
"version": "v1.37.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
"reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
"reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
"shasum": ""
},
"require": {
@@ -4792,7 +4791,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.37.0"
},
"funding": [
{
@@ -4812,7 +4811,7 @@
"type": "tidelift"
}
],
"time": "2025-01-02T08:10:11+00:00"
"time": "2026-04-10T16:19:22+00:00"
},
{
"name": "theseer/tokenizer",
@@ -4953,8 +4952,8 @@
{
"package": "utopia-php/database",
"version": "dev-big-init",
"alias": "5.4",
"alias_normalized": "5.4.0.0"
"alias": "5.77",
"alias_normalized": "5.77.0.0"
}
],
"minimum-stability": "stable",
File diff suppressed because it is too large. Load diff
-1
View File
@@ -316,5 +316,4 @@ class JSON extends Destination
return $this->convertValueToJSON($item);
}, $value);
}
}
@@ -0,0 +1,70 @@
<?php
namespace Utopia\Migration\Destinations;
enum SchemaAction
{
case Create;
case Skip;
case Overwrite;
}
enum OnDuplicate: string
{
case Fail = 'fail';
case Skip = 'skip';
case Overwrite = 'overwrite';
/**
* @return list<string>
*/
public static function values(): array
{
return \array_values(\array_map(fn (self $case) => $case->value, self::cases()));
}
/**
* Coarse routing for re-migration. The caller follows up with a spec-match
* check that overrides Overwrite to Skip when source and dest
* already have identical spec — see DestinationAppwrite for the full flow.
*/
public function resolveSchemaAction(
bool $exists,
?string $sourceUpdatedAt = null,
?string $destUpdatedAt = null,
): SchemaAction {
if (!$exists) {
return SchemaAction::Create;
}
return match ($this) {
self::Fail => SchemaAction::Create,
self::Skip => SchemaAction::Skip,
self::Overwrite => $this->sourceIsNewer($sourceUpdatedAt, $destUpdatedAt)
? SchemaAction::Overwrite
: SchemaAction::Skip,
};
}
private function sourceIsNewer(?string $source, ?string $dest): bool
{
$src = $this->parseTimestamp($source);
$dst = $this->parseTimestamp($dest);
return $src !== null && $dst !== null && $src > $dst;
}
/**
* strtotime accepts '0000-00-00' leniently (returns a large negative epoch,
* not false), so non-positive epochs are rejected too.
*/
private function parseTimestamp(?string $value): ?int
{
if ($value === null || $value === '') {
return null;
}
$epoch = \strtotime($value);
if ($epoch === false || $epoch <= 0) {
return null;
}
return $epoch;
}
}
+4
View File
@@ -75,6 +75,9 @@ abstract class Resource implements \JsonSerializable
public const TYPE_MESSAGE = 'message';
// Backups
public const TYPE_BACKUP_POLICY = 'backup-policy';
// legacy terminologies
public const TYPE_DOCUMENT = 'document';
public const TYPE_ATTRIBUTE = 'attribute';
@@ -110,6 +113,7 @@ abstract class Resource implements \JsonSerializable
self::TYPE_TOPIC,
self::TYPE_SUBSCRIBER,
self::TYPE_MESSAGE,
self::TYPE_BACKUP_POLICY,
// legacy
self::TYPE_DOCUMENT,
+115
View File
@@ -0,0 +1,115 @@
<?php
namespace Utopia\Migration\Resources\Backups;
use Utopia\Migration\Resource;
use Utopia\Migration\Transfer;
class Policy extends Resource
{
/**
* @param string $id
* @param string $name
* @param array<string> $services
* @param int $retention
* @param string $schedule
* @param bool $enabled
* @param string $resourceId
* @param string $resourceType
*/
public function __construct(
string $id = '',
private readonly string $name = '',
private readonly array $services = [],
private readonly int $retention = 0,
private readonly string $schedule = '',
private readonly bool $enabled = true,
private readonly string $resourceId = '',
private readonly string $resourceType = '',
) {
$this->id = $id;
}
/**
* @param array<string, mixed> $array
* @return self
*/
public static function fromArray(array $array): self
{
return new self(
$array['id'],
$array['name'] ?? '',
$array['services'] ?? [],
$array['retention'] ?? 0,
$array['schedule'] ?? '',
$array['enabled'] ?? true,
$array['resourceId'] ?? '',
$array['resourceType'] ?? '',
);
}
/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
return [
'id' => $this->id,
'name' => $this->name,
'services' => $this->services,
'retention' => $this->retention,
'schedule' => $this->schedule,
'enabled' => $this->enabled,
'resourceId' => $this->resourceId,
'resourceType' => $this->resourceType,
];
}
public static function getName(): string
{
return Resource::TYPE_BACKUP_POLICY;
}
public function getGroup(): string
{
return Transfer::GROUP_BACKUPS;
}
public function getPolicyName(): string
{
return $this->name;
}
/**
* @return array<string>
*/
public function getServices(): array
{
return $this->services;
}
public function getRetention(): int
{
return $this->retention;
}
public function getSchedule(): string
{
return $this->schedule;
}
public function getEnabled(): bool
{
return $this->enabled;
}
public function getResourceId(): string
{
return $this->resourceId;
}
public function getResourceType(): string
{
return $this->resourceType;
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ class Table extends Resource
Database::fromArray($array['database']),
name: $array['name'],
id: $array['id'],
rowSecurity: $array['rowSecurity'] ?? $array['documentSecurity'],
rowSecurity: (bool) ($array['rowSecurity'] ?? $array['documentSecurity'] ?? false),
permissions: $array['permissions'] ?? [],
createdAt: $array['createdAt'] ?? '',
updatedAt: $array['updatedAt'] ?? '',
-1
View File
@@ -67,5 +67,4 @@ class EnvVar extends Resource
{
return $this->value;
}
}
+17
View File
@@ -46,6 +46,11 @@ abstract class Source extends Target
return static::$defaultBatchSize;
}
public function getBackupsBatchSize(): int
{
return static::$defaultBatchSize;
}
/**
* @param array<Resource> $resources
* @return void
@@ -109,6 +114,7 @@ abstract class Source extends Target
Transfer::GROUP_FUNCTIONS => Transfer::GROUP_FUNCTIONS_RESOURCES,
Transfer::GROUP_MESSAGING => Transfer::GROUP_MESSAGING_RESOURCES,
Transfer::GROUP_SITES => Transfer::GROUP_SITES_RESOURCES,
Transfer::GROUP_BACKUPS => Transfer::GROUP_BACKUPS_RESOURCES,
];
foreach ($mapping as $group => $resources) {
@@ -143,6 +149,9 @@ abstract class Source extends Target
case Transfer::GROUP_SITES:
$this->exportGroupSites($this->getSitesBatchSize(), $resources);
break;
case Transfer::GROUP_BACKUPS:
$this->exportGroupBackups($this->getBackupsBatchSize(), $resources);
break;
}
}
}
@@ -194,4 +203,12 @@ abstract class Source extends Target
* @param array<string> $resources Resources to export
*/
abstract protected function exportGroupSites(int $batchSize, array $resources): void;
/**
* Export Backups Group
*
* @param int $batchSize
* @param array<string> $resources Resources to export
*/
abstract protected function exportGroupBackups(int $batchSize, array $resources): void;
}
+24 -9
View File
@@ -5,11 +5,11 @@ namespace Utopia\Migration\Sources;
use Appwrite\AppwriteException;
use Appwrite\Client;
use Appwrite\Query;
use Appwrite\Services\Databases;
use Appwrite\Services\Functions;
use Appwrite\Services\Messaging;
use Appwrite\Services\Sites;
use Appwrite\Services\Storage;
use Appwrite\Services\TablesDB;
use Appwrite\Services\Teams;
use Appwrite\Services\Users;
use Utopia\Database\Database as UtopiaDatabase;
@@ -128,7 +128,7 @@ class Appwrite extends Source
switch ($this->source) {
case static::SOURCE_API:
$this->reader = new APIReader(new Databases($this->client));
$this->reader = new APIReader(new TablesDB($this->client));
break;
case static::SOURCE_DATABASE:
@@ -145,7 +145,6 @@ class Appwrite extends Source
default:
throw new \Exception('Unknown source', Exception::CODE_VALIDATION);
}
}
public static function getName(): string
@@ -201,6 +200,9 @@ class Appwrite extends Source
Resource::TYPE_SITE_DEPLOYMENT,
Resource::TYPE_SITE_VARIABLE,
// Backups
Resource::TYPE_BACKUP_POLICY,
// Settings
];
}
@@ -240,6 +242,7 @@ class Appwrite extends Source
$this->reportFunctions($resources, $report, $resourceIds);
$this->reportMessaging($resources, $report, $resourceIds);
$this->reportSites($resources, $report, $resourceIds);
$this->reportBackups($resources, $report, $resourceIds);
$report['version'] = $this->call(
'GET',
@@ -355,7 +358,6 @@ class Appwrite extends Source
*/
private function reportStorage(array $resources, array &$report, array $resourceIds = []): void
{
if (\in_array(Resource::TYPE_BUCKET, $resources)) {
$bucketQueries = $this->buildQueries(
resourceType: Resource::TYPE_BUCKET,
@@ -870,7 +872,6 @@ class Appwrite extends Source
'enabled' => $database['enabled'] ?? true,
]);
$databases[] = $newDatabase;
}
}
@@ -929,10 +930,12 @@ class Appwrite extends Source
$response = $this->reader->listTables($database, $queries);
foreach ($response as $table) {
$rowSecurity = $table['rowSecurity'] ?? $table['documentSecurity'] ?? false;
$newTable = self::getEntity($databaseName, [
'id' => $table['$id'],
'name' => $table['name'],
'documentSecurity' => $table['documentSecurity'],
'rowSecurity' => $rowSecurity,
'documentSecurity' => $rowSecurity,
'permissions' => $table['$permissions'],
'createdAt' => $table['$createdAt'],
'updatedAt' => $table['$updatedAt'],
@@ -996,7 +999,7 @@ class Appwrite extends Source
}
/** @var Table $table */
$col = match($table->getDatabase()->getType()) {
$col = match ($table->getDatabase()->getType()) {
Resource::TYPE_DATABASE_VECTORSDB => self::getColumn($table, $column)->getAttribute(),
default => self::getColumn($table, $column),
};
@@ -1154,10 +1157,11 @@ class Appwrite extends Source
unset($row['$id']);
unset($row['$permissions']);
unset($row['$collectionId']);
unset($row['$databaseId']);
unset($row['$sequence']);
unset($row['$collection']);
unset($row['$tableId']);
unset($row['$table']);
$row = self::getRecord($table->getDatabase()->getType(), [
'id' => $id,
@@ -1422,6 +1426,18 @@ class Appwrite extends Source
}
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
// No-op: backup policies are Cloud-only
}
protected function reportBackups(array $resources, array &$report, array $resourceIds = []): void
{
if (\in_array(Resource::TYPE_BACKUP_POLICY, $resources)) {
$report[Resource::TYPE_BACKUP_POLICY] = 0;
}
}
/**
* @throws AppwriteException
*/
@@ -2509,7 +2525,6 @@ class Appwrite extends Source
default => throw new \InvalidArgumentException("Unsupported column type: {$column['type']}"),
};
}
/**
@@ -108,5 +108,4 @@ interface Reader
*/
public function queryLimit(int $limit): mixed;
public function getSupportForAttributes(): bool;
}
+12 -21
View File
@@ -4,8 +4,7 @@ namespace Utopia\Migration\Sources\Appwrite\Reader;
use Appwrite\AppwriteException;
use Appwrite\Query;
use Appwrite\Services\Databases;
/* use Appwrite\Services\Tables; */
use Appwrite\Services\TablesDB;
use Utopia\Migration\Resource;
use Utopia\Migration\Resources\Database\Database;
use Utopia\Migration\Resources\Database\Table;
@@ -17,8 +16,7 @@ use Utopia\Migration\Sources\Appwrite\Reader;
class API implements Reader
{
public function __construct(
private readonly Databases $database,
/* private readonly Tables $table, */
private readonly TablesDB $database,
) {
}
@@ -73,13 +71,12 @@ class API implements Reader
$lastTable = null;
while (true) {
/* $currentTables = $this->tables->list(...); */
$currentTables = $this->database->listCollections(
$currentTables = $this->database->listTables(
$databaseId,
$lastTable
? [Query::cursorAfter($lastTable)]
: [Query::limit($pageLimit)]
)['collections']; /* ['tables'] */
)['tables'];
$tables = \array_merge($tables, $currentTables);
$lastTable = $tables[count($tables) - 1]['$id'] ?? null;
@@ -108,8 +105,7 @@ class API implements Reader
}
if (Resource::isSupported(Resource::TYPE_ROW, $resources)) {
/* $rowsResponse = $this->tables->listRows(...) */
$rowsResponse = $this->database->listDocuments(
$rowsResponse = $this->database->listRows(
$databaseId,
$tableId,
[Query::limit(1)]
@@ -137,11 +133,10 @@ class API implements Reader
*/
public function listTables(Database $resource, array $queries = []): array
{
/* $this->tables->list(...)['tables'] */
return $this->database->listCollections(
return $this->database->listTables(
$resource->getId(),
$queries
)['collections'];
)['tables'];
}
/**
@@ -152,12 +147,11 @@ class API implements Reader
*/
public function listColumns(Table $resource, array $queries = []): array
{
/* $this->tables->listColumns(...)['columns'] */
return $this->database->listAttributes(
return $this->database->listColumns(
$resource->getDatabase()->getId(),
$resource->getId(),
$queries
)['attributes'];
)['columns'];
}
/**
@@ -168,7 +162,6 @@ class API implements Reader
*/
public function listIndexes(Table $resource, array $queries = []): array
{
/* $this->tables->listIndexes(...)['indexes'] */
return $this->database->listIndexes(
$resource->getDatabase()->getId(),
$resource->getId(),
@@ -185,12 +178,11 @@ class API implements Reader
*/
public function listRows(Table $resource, array $queries = []): array
{
/* $this->tables->listRows(...)['rows'] */
return $this->database->listDocuments(
return $this->database->listRows(
$resource->getDatabase()->getId(),
$resource->getId(),
$queries
)['documents'];
)['rows'];
}
/**
@@ -202,8 +194,7 @@ class API implements Reader
*/
public function getRow(Table $resource, string $rowId, array $queries = []): array
{
/* $this->tables->getRow(...) */
return $this->database->getDocument(
return $this->database->getRow(
$resource->getDatabase()->getId(),
$resource->getId(),
$rowId,
+5
View File
@@ -430,6 +430,11 @@ class CSV extends Source
throw new \Exception('Not Implemented');
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
/**
* @param callable(resource $stream, string $delimiter): void $callback
* @return void
+5 -1
View File
@@ -667,7 +667,6 @@ class Firebase extends Source
previous: $e
));
}
}
private function exportBuckets(int $batchsize): void
@@ -818,4 +817,9 @@ class Firebase extends Source
{
throw new \Exception('Not implemented');
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
throw new \Exception('Not implemented');
}
}
+5
View File
@@ -209,6 +209,11 @@ class JSON extends Source
throw new \Exception('Not Implemented');
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
/**
* @throws \Exception
*/
+5
View File
@@ -952,4 +952,9 @@ class NHost extends Source
{
throw new \Exception('Not Implemented');
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
throw new \Exception('Not Implemented');
}
}
-1
View File
@@ -150,7 +150,6 @@ abstract class Target
throw new \Exception(\curl_error($ch), Exception::CODE_INTERNAL);
}
\curl_close($ch);
if ($responseStatus >= 400) {
if (\is_array($responseBody)) {
+8
View File
@@ -26,6 +26,8 @@ class Transfer
public const GROUP_MESSAGING = 'messaging';
public const GROUP_BACKUPS = 'backups';
public const GROUP_AUTH_RESOURCES = [
Resource::TYPE_USER,
Resource::TYPE_TEAM,
@@ -88,6 +90,10 @@ class Transfer
public const GROUP_SETTINGS_RESOURCES = [];
public const GROUP_BACKUPS_RESOURCES = [
Resource::TYPE_BACKUP_POLICY,
];
public const GROUP_MESSAGING_RESOURCES = [
Resource::TYPE_PROVIDER,
Resource::TYPE_TOPIC,
@@ -116,6 +122,7 @@ class Transfer
Resource::TYPE_TOPIC,
Resource::TYPE_SUBSCRIBER,
Resource::TYPE_MESSAGE,
Resource::TYPE_BACKUP_POLICY,
// legacy
Resource::TYPE_DOCUMENT,
@@ -399,6 +406,7 @@ class Transfer
self::GROUP_DATABASES_VECTOR_DB => array_merge($resources, self::GROUP_VECTORSDB_RESOURCES),
self::GROUP_SETTINGS => array_merge($resources, self::GROUP_SETTINGS_RESOURCES),
self::GROUP_MESSAGING => array_merge($resources, self::GROUP_MESSAGING_RESOURCES),
self::GROUP_BACKUPS => array_merge($resources, self::GROUP_BACKUPS_RESOURCES),
default => throw new \Exception('No service group found'),
};
}
-1
View File
@@ -124,7 +124,6 @@ abstract class Base extends TestCase
throw new \Exception(curl_error($ch));
}
curl_close($ch);
if ($responseStatus >= 400) {
if (is_array($responseBody)) {
@@ -84,6 +84,7 @@ class MockSource extends Source
Resource::TYPE_TOPIC,
Resource::TYPE_SUBSCRIBER,
Resource::TYPE_MESSAGE,
Resource::TYPE_BACKUP_POLICY,
// legacy
Resource::TYPE_DOCUMENT,
@@ -198,4 +199,15 @@ class MockSource extends Source
$this->handleResourceTransfer(Transfer::GROUP_SITES, $resource);
}
}
protected function exportGroupBackups(int $batchSize, array $resources): void
{
foreach (Transfer::GROUP_BACKUPS_RESOURCES as $resource) {
if (!\in_array($resource, $resources)) {
continue;
}
$this->handleResourceTransfer(Transfer::GROUP_BACKUPS, $resource);
}
}
}
@@ -0,0 +1,96 @@
<?php
namespace Migration\Unit\Destinations;
use Appwrite\Services\Databases;
use Appwrite\Services\TablesDB;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use ReflectionMethod;
use Utopia\Migration\Destinations\Appwrite as AppwriteDestination;
/**
* Lock-in for the SDK boundary that drives ATTRIBUTE_IMMUTABLE_FIELDS.
*
* Reflects on appwrite/appwrite's TablesDB + Databases services. If the SDK
* ships a new updateXColumn / updateXAttribute endpoint that exposes a
* previously-non-SDK field, this test fails so DestinationAppwrite's
* ATTRIBUTE_IMMUTABLE_FIELDS constant can be synced. Catches drift in CI
* rather than at runtime.
*/
class AppwriteAttributeSdkBoundaryTest extends TestCase
{
/** Routing/identity params that aren't mutable column state. */
private const IGNORED_PARAMS = ['databaseId', 'tableId', 'collectionId', 'key', 'newKey'];
/**
* SDK param name → meta-doc field name. Param names that don't appear on
* the meta doc as a top-level key map to null (e.g. min/max/elements live
* inside formatOptions; onDelete lives inside the relationship's options).
*
* @var array<string, string|null>
*/
private const PARAM_TO_META_FIELD = [
'xdefault' => 'default',
'min' => null,
'max' => null,
'elements' => null,
'onDelete' => null,
];
public function testSdkExposedFieldsAreNotInNonSdkConstant(): void
{
$sdkExposed = $this->collectSdkExposedMetaFields();
$nonSdk = $this->readNonSdkConstant();
$overlap = \array_intersect($sdkExposed, $nonSdk);
$this->assertSame(
[],
\array_values($overlap),
'ATTRIBUTE_IMMUTABLE_FIELDS marks these fields as non-SDK, but the appwrite/appwrite '
. 'SDK exposes them via updateXColumn/updateXAttribute: ' . \implode(', ', $overlap)
. '. Either drop these from ATTRIBUTE_IMMUTABLE_FIELDS or update PARAM_TO_META_FIELD '
. 'in this test if the SDK param doesn\'t correspond to a top-level meta-doc field.',
);
}
/**
* @return list<string> meta-doc field names the SDK can mutate
*/
private function collectSdkExposedMetaFields(): array
{
$fields = [];
foreach ([TablesDB::class, Databases::class] as $service) {
$service = new ReflectionClass($service);
foreach ($service->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if (!\preg_match('/^update.+(Column|Attribute)$/', $method->getName())) {
continue;
}
foreach ($method->getParameters() as $param) {
$name = $param->getName();
if (\in_array($name, self::IGNORED_PARAMS, true)) {
continue;
}
$mapped = \array_key_exists($name, self::PARAM_TO_META_FIELD)
? self::PARAM_TO_META_FIELD[$name]
: $name;
if ($mapped === null) {
continue;
}
$fields[$mapped] = true;
}
}
}
return \array_keys($fields);
}
/**
* @return list<string>
*/
private function readNonSdkConstant(): array
{
/** @var list<string> $value */
$value = (new ReflectionClass(AppwriteDestination::class))->getConstant('ATTRIBUTE_IMMUTABLE_FIELDS');
return $value;
}
}
@@ -0,0 +1,155 @@
<?php
namespace Migration\Unit\General;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Utopia\Migration\Destinations\OnDuplicate;
use Utopia\Migration\Destinations\SchemaAction;
/**
* OnDuplicate::resolveSchemaAction is the load-bearing decision point for
* re-migration tolerance. The destination then runs a spec-match guard that
* overrides Overwrite to Skip when source and dest already have
* identical spec — see DestinationAppwrite. These tests lock the
* mode × existence × updatedAt matrix.
*/
class OnDuplicateTest extends TestCase
{
public function testNotExistsAlwaysCreates(): void
{
foreach (OnDuplicate::cases() as $mode) {
$this->assertSame(
SchemaAction::Create,
$mode->resolveSchemaAction(exists: false),
"{$mode->value} on non-existing resource must return Create",
);
}
}
public function testFailExistsReturnsCreateSoCallerDDLThrows(): void
{
// Fail is routed through Create (not Skip) so the caller's normal
// create flow runs and the library surfaces DuplicateException as
// designed. Returning Skip here would silently hide the error.
$this->assertSame(
SchemaAction::Create,
OnDuplicate::Fail->resolveSchemaAction(exists: true),
);
}
public function testSkipAlwaysSkipsExisting(): void
{
// Skip must ignore updatedAt entirely — it's the "don't touch" contract.
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Skip->resolveSchemaAction(
exists: true,
sourceUpdatedAt: '2026-01-01T00:00:00.000+00:00',
destUpdatedAt: '2020-01-01T00:00:00.000+00:00',
),
);
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Skip->resolveSchemaAction(
exists: true,
sourceUpdatedAt: '2020-01-01T00:00:00.000+00:00',
destUpdatedAt: '2026-01-01T00:00:00.000+00:00',
),
);
}
public function testOverwriteSourceNewerUpdatesInPlace(): void
{
// Source updatedAt strictly newer than dest → Overwrite. The
// caller (DestinationAppwrite) follows up with attribute/index spec
// checks and falls through to drop+recreate when the SDK can't
// express the change.
$this->assertSame(
SchemaAction::Overwrite,
OnDuplicate::Overwrite->resolveSchemaAction(
exists: true,
sourceUpdatedAt: '2026-04-23T10:00:00.000+00:00',
destUpdatedAt: '2026-04-23T09:59:59.000+00:00',
),
);
}
public function testOverwriteSourceEqualSkips(): void
{
$when = '2026-04-23T10:00:00.000+00:00';
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Overwrite->resolveSchemaAction(
exists: true,
sourceUpdatedAt: $when,
destUpdatedAt: $when,
),
);
}
public function testOverwriteSourceOlderSkips(): void
{
// Dest is ahead — don't roll back. Avoids overwriting newer
// destination edits with stale source data.
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Overwrite->resolveSchemaAction(
exists: true,
sourceUpdatedAt: '2026-04-23T09:00:00.000+00:00',
destUpdatedAt: '2026-04-23T10:00:00.000+00:00',
),
);
}
public function testOverwriteNoTimestampsSkips(): void
{
// No timestamps provided at all → no information to act on. Conservative:
// Skip rather than risk a destructive update on uncertain input.
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Overwrite->resolveSchemaAction(exists: true),
);
}
/**
* @return array<string, array{0: ?string, 1: ?string}>
*/
public static function unparseableTimestampPairs(): array
{
return [
'both empty' => ['', ''],
'both null' => [null, null],
'source empty' => ['', '2026-04-23T10:00:00.000+00:00'],
'dest empty' => ['2026-04-23T10:00:00.000+00:00', ''],
'source null' => [null, '2026-04-23T10:00:00.000+00:00'],
'dest null' => ['2026-04-23T10:00:00.000+00:00', null],
'source zero-date' => ['0000-00-00 00:00:00', '2026-04-23T10:00:00.000+00:00'],
'dest zero-date' => ['2026-04-23T10:00:00.000+00:00', '0000-00-00 00:00:00'],
'source garbage' => ['not-a-date', '2026-04-23T10:00:00.000+00:00'],
'dest garbage' => ['2026-04-23T10:00:00.000+00:00', 'not-a-date'],
];
}
#[DataProvider('unparseableTimestampPairs')]
public function testOverwriteUnparseableUpdatedAtSkips(?string $source, ?string $dest): void
{
// Conservative: unparseable updatedAt preserves existing destination
// rather than risk a destructive update on garbage input.
$this->assertSame(
SchemaAction::Skip,
OnDuplicate::Overwrite->resolveSchemaAction(
exists: true,
sourceUpdatedAt: $source,
destUpdatedAt: $dest,
),
);
}
public function testValuesListsAllCasesInDeclarationOrder(): void
{
// The values() helper is consumed by API/SDK param validators; this
// protects against an accidental case-rename or reorder.
$this->assertSame(['fail', 'skip', 'overwrite'], OnDuplicate::values());
}
}