diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 4939dc8143..d342875369 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -34,6 +34,13 @@ class Migrations extends Action protected Document $project; + /** + * Cached for performance. + * + * @var array + */ + protected array $sourceReport = []; + /** * @var callable */ @@ -101,7 +108,7 @@ class Migrations extends Action $source = $migration->getAttribute('source'); $credentials = $migration->getAttribute('credentials'); - return match ($source) { + $migrationSource = match ($source) { Firebase::getName() => new Firebase( json_decode($credentials['serviceAccount'], true), ), @@ -130,6 +137,10 @@ class Migrations extends Action ), default => throw new \Exception('Invalid source type'), }; + + $this->sourceReport = $migrationSource->report(); + + return $migrationSource; } /** @@ -245,8 +256,6 @@ class Migrations extends Action $source = $this->processSource($migration); $destination = $this->processDestination($migration, $tempAPIKey); - $source->report(); - $transfer = new Transfer( $source, $destination