(fix): set project on UserEvents, stop removing $collection, update migration lib

- UserEvents hook: set project on events before triggering to fix null
  project in function worker queue messages. Also use $this->project
  directly for console check instead of $this->events->getProject()
  which was null.
- Metadata decorator: stop removing $collection from documents since
  the Response model layer already handles this in filter(). Removing it
  in the decorator broke updateDocument and cursor pagination.
- Update utopia-php/migration to feat-query-lib branch with ColumnType
  enum, Attribute objects, and removed Database::VAR_* constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake BarnbyandClaude Opus 4.6 committed 2026-04-01 00:23:09 +13:00
1 parent 44d7591dd1
commit 7fc153d344
4 files changed
+43 -15

No files matched your search

+5 -1
View File
@@ -73,7 +73,7 @@
"utopia-php/locale": "0.8.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.20.*",
"utopia-php/migration": "1.8.*",
"utopia-php/migration": "dev-feat-query-lib as 1.8.0",
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "1.*",
"utopia-php/span": "1.1.*",
@@ -115,6 +115,10 @@
{
"type": "vcs",
"url": "https://github.com/utopia-php/async.git"
},
{
"type": "vcs",
"url": "https://github.com/utopia-php/migration.git"
}
],
"config": {
Generated
+36 -11
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": "a51e9764f643f4283d593e63f61cb4e5",
"content-hash": "9d66f869fc3ff5abc5873a31e6976911",
"packages": [
{
"name": "adhocore/jwt",
@@ -4704,16 +4704,16 @@
},
{
"name": "utopia-php/migration",
"version": "1.8.3",
"version": "dev-feat-query-lib",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "8633523b3343d492427331b6eec53f020f6ab7a7"
"reference": "7c0e2d4f065c72f8b8424bbc06cb4aecbf28915a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/8633523b3343d492427331b6eec53f020f6ab7a7",
"reference": "8633523b3343d492427331b6eec53f020f6ab7a7",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/7c0e2d4f065c72f8b8424bbc06cb4aecbf28915a",
"reference": "7c0e2d4f065c72f8b8424bbc06cb4aecbf28915a",
"shasum": ""
},
"require": {
@@ -4722,7 +4722,7 @@
"ext-openssl": "*",
"halaxa/json-machine": "^1.2",
"php": ">=8.1",
"utopia-php/database": "5.*",
"utopia-php/database": "dev-feat-query-lib as 5.3.17",
"utopia-php/dsn": "0.2.*",
"utopia-php/storage": "1.0.*"
},
@@ -4739,7 +4739,25 @@
"Utopia\\Migration\\": "src/Migration"
}
},
"notification-url": "https://packagist.org/downloads/",
"autoload-dev": {
"psr-4": {
"Utopia\\Tests\\": "tests/Migration"
}
},
"scripts": {
"test": [
"./vendor/bin/phpunit"
],
"lint": [
"./vendor/bin/pint --test"
],
"format": [
"./vendor/bin/pint"
],
"check": [
"./vendor/bin/phpstan analyse --level 3 src tests --memory-limit 2G"
]
},
"license": [
"MIT"
],
@@ -4752,10 +4770,10 @@
"utopia"
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/1.8.3"
"source": "https://github.com/utopia-php/migration/tree/feat-query-lib",
"issues": "https://github.com/utopia-php/migration/issues"
},
"time": "2026-03-19T09:18:47+00:00"
"time": "2026-03-31T11:14:26+00:00"
},
{
"name": "utopia-php/mongo",
@@ -8678,12 +8696,19 @@
"version": "dev-feat-query-lib",
"alias": "5.3.17",
"alias_normalized": "5.3.17.0"
},
{
"package": "utopia-php/migration",
"version": "dev-feat-query-lib",
"alias": "1.8.0",
"alias_normalized": "1.8.0.0"
}
],
"minimum-stability": "dev",
"stability-flags": {
"utopia-php/audit": 20,
"utopia-php/database": 20
"utopia-php/database": 20,
"utopia-php/migration": 20
},
"prefer-stable": true,
"prefer-lowest": false,
@@ -39,7 +39,6 @@ class Metadata implements Decorator
$this->operations++;
$collectionId = $collection->getId();
$document->removeAttribute('$collection');
$document->setAttribute('$databaseId', $this->database->getId());
$document->setAttribute('$' . $this->context . 'Id', $collectionId);
@@ -90,7 +89,6 @@ class Metadata implements Decorator
foreach ($relations as $relation) {
if ($relation instanceof Document) {
$this->operations++;
$relation->removeAttribute('$collection');
$relation->setAttribute('$databaseId', $this->database->getId());
$relation->setAttribute('$' . $this->context . 'Id', $relatedCollectionId);
@@ -39,6 +39,7 @@ class UserEvents implements Lifecycle
}
$this->events
->setProject($this->project)
->setEvent('users.[userId].create')
->setParam('userId', $data->getId())
->setPayload($this->response->output($data, Response::MODEL_USER));
@@ -53,7 +54,7 @@ class UserEvents implements Lifecycle
->trigger();
}
if ($this->events->getProject()->getId() !== 'console') {
if ($this->project->getId() !== 'console') {
$this->realtime
->from($this->events)
->trigger();