fix(migrations): use compatible resource selectors

This commit is contained in:
Jake Barnby committed 2026-07-20 22:15:44 +12:00
1 parent bc426845d6
commit 700a4c32f4
3 files changed
+41 -40

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@
"utopia-php/lock": "0.2.*",
"utopia-php/logger": "0.8.*",
"utopia-php/messaging": "^1.2",
"utopia-php/migration": "dev-feat/drop-compound-resource-id#a7e94c86a96fc7cdfff3eae9845270d91f83e7f8 as 1.17.3",
"utopia-php/migration": "dev-feat/drop-compound-resource-id#7ed62ca2e2279bf30fa2018655e045c59bb5bc3d as 1.17.3",
"utopia-php/platform": "^1.0@RC",
"utopia-php/pools": "1.*",
"utopia-php/span": "3.0.*",
Generated
+5 -5
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": "4d8282e455d647d1132ef9c0340924a1",
"content-hash": "de9b7927d2e0c923329b782e737ab716",
"packages": [
{
"name": "adhocore/jwt",
@@ -4404,12 +4404,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "a7e94c86a96fc7cdfff3eae9845270d91f83e7f8"
"reference": "7ed62ca2e2279bf30fa2018655e045c59bb5bc3d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/a7e94c86a96fc7cdfff3eae9845270d91f83e7f8",
"reference": "a7e94c86a96fc7cdfff3eae9845270d91f83e7f8",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/7ed62ca2e2279bf30fa2018655e045c59bb5bc3d",
"reference": "7ed62ca2e2279bf30fa2018655e045c59bb5bc3d",
"shasum": ""
},
"require": {
@@ -4469,7 +4469,7 @@
"source": "https://github.com/utopia-php/migration/tree/feat/drop-compound-resource-id",
"issues": "https://github.com/utopia-php/migration/issues"
},
"time": "2026-07-17T12:11:07+00:00"
"time": "2026-07-17T20:50:27+00:00"
},
{
"name": "utopia-php/mongo",
+35 -34
View File
@@ -290,20 +290,20 @@ class Migrations extends Action
$projectDB,
$queries
),
CSV::getName() => new CSV(
$databaseId,
$tableId,
$migrationOptions['path'],
$this->deviceForMigrations,
$this->dbForProject,
$getDatabasesDB
CSV::getName() => CSV::fromResourceIds(
databaseId: $databaseId,
tableId: $tableId,
filePath: $migrationOptions['path'],
device: $this->deviceForMigrations,
dbForProject: $this->dbForProject,
getDatabasesDB: $getDatabasesDB,
),
JSON::getName() => new JSON(
$databaseId,
$tableId,
$migrationOptions['path'],
$this->deviceForMigrations,
$this->dbForProject,
JSON::getName() => JSON::fromResourceIds(
databaseId: $databaseId,
tableId: $tableId,
filePath: $migrationOptions['path'],
device: $this->deviceForMigrations,
dbForProject: $this->dbForProject,
),
default => throw new Exception(Exception::MIGRATION_SOURCE_TYPE_INVALID),
};
@@ -337,25 +337,25 @@ class Migrations extends Action
OnDuplicate::tryFrom($options['onDuplicate'] ?? '') ?? OnDuplicate::Fail,
$this->resolveDestinationDatabaseDsn(...),
),
DestinationCSV::getName() => new DestinationCSV(
$this->deviceForFiles,
$databaseId,
$tableId,
$options['bucketId'],
$migration->getId(),
$options['columns'],
$options['delimiter'],
$options['enclosure'],
$options['escape'],
$options['header'],
DestinationCSV::getName() => DestinationCSV::fromResourceIds(
deviceForFiles: $this->deviceForFiles,
databaseId: $databaseId,
tableId: $tableId,
directory: $options['bucketId'],
filename: $options['filename'],
allowedColumns: $options['columns'],
delimiter: $options['delimiter'],
enclosure: $options['enclosure'],
escape: $options['escape'],
includeHeaders: $options['header'],
),
DestinationJSON::getName() => new DestinationJSON(
$this->deviceForFiles,
$databaseId,
$tableId,
$options['bucketId'] ?? 'default',
$migration->getId(),
$options['columns'] ?? [],
DestinationJSON::getName() => DestinationJSON::fromResourceIds(
deviceForFiles: $this->deviceForFiles,
databaseId: $databaseId,
tableId: $tableId,
directory: $options['bucketId'] ?? 'default',
filename: $options['filename'],
allowedColumns: $options['columns'] ?? [],
),
default => throw new Exception(Exception::MIGRATION_DESTINATION_TYPE_INVALID),
};
@@ -540,7 +540,8 @@ class Migrations extends Action
$migration->setAttribute('stage', 'migrating');
$this->updateMigrationDocument($migration, $project, $queueForRealtime);
$transfer->run(
[$rootResourceId, $rootResourceChildId] = $this->resolveResourceIds($migration);
$transfer->runWithResourceSelector(
$migration->getAttribute('resources'),
function ($resources) use ($migration, $transfer, $project, $queueForRealtime, &$aggregatedResources) {
$migration->setAttribute('resourceData', json_encode($transfer->getCache()));
@@ -578,9 +579,9 @@ class Migrations extends Action
}
$this->updateMigrationDocument($migration, $project, $queueForRealtime);
},
$this->resolveResourceIds($migration)[0],
$rootResourceId,
$migration->getAttribute('parentResourceType') ?: $migration->getAttribute('resourceType'),
$this->resolveResourceIds($migration)[1],
$rootResourceChildId,
);
$destination->shutdown();