From eb1d4c68ea5f10b582fb84e7669796cb507c9994 Mon Sep 17 00:00:00 2001 From: Darshan Date: Wed, 2 Jul 2025 14:54:25 +0530 Subject: [PATCH] add: logging. --- src/Appwrite/Platform/Workers/Migrations.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 573772835e..9c5f9b6f79 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -154,6 +154,8 @@ class Migrations extends Action $this->sourceReport = $migrationSource->report(); + Console::log(json_encode(['stage' => 'processSource', 'source' => $source], JSON_PRETTY_PRINT)); + return $migrationSource; } @@ -164,6 +166,8 @@ class Migrations extends Action { $destination = $migration->getAttribute('destination'); + Console::log(json_encode(['stage' => 'processDestination', 'destination' => $destination], JSON_PRETTY_PRINT)); + return match ($destination) { DestinationAppwrite::getName() => new DestinationAppwrite( $this->project->getId(), @@ -214,6 +218,12 @@ class Migrations extends Action ->setPayload($clonedMigrationDocument->getArrayCopy(), ['options', 'credentials']) ->trigger(); + Console::log(json_encode([ + 'stage' => 'updateMigrationDocument', + 'migration' => $migration, + 'clonedMigration' => $clonedMigrationDocument + ], JSON_PRETTY_PRINT)); + return $this->dbForProject->updateDocument('migrations', $migration->getId(), $migration); } @@ -306,6 +316,15 @@ class Migrations extends Action $transfer->run( $migration->getAttribute('resources'), function () use ($migration, $transfer, $projectDocument, $queueForRealtime) { + Console::log(json_encode([ + 'stage' => 'transfer#run', + 'migration' => $migration, + 'details' => [ + 'resourceData' => $transfer->getCache(), + 'statusCounters' => $transfer->getStatusCounters() + ] + ], JSON_PRETTY_PRINT)); + $migration->setAttribute('resourceData', json_encode($transfer->getCache())); $migration->setAttribute('statusCounters', json_encode($transfer->getStatusCounters())); $this->updateMigrationDocument($migration, $projectDocument, $queueForRealtime);