diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index d78f207998..66f39a4336 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -337,22 +337,22 @@ class Migrations extends Action $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); try { - if ($migration->getAttribute('source') === SourceAppwrite::getName()) { - $credentials = $migration->getAttribute('credentials', []); + $credentials = $migration->getAttribute('credentials', []); + if ($migration->getAttribute('source') === SourceAppwrite::getName()) { if (empty($credentials)) { $credentials['projectId'] = $project->getId(); $credentials['apiKey'] = $tempAPIKey; $credentials['endpoint'] = $endpoint; } - - if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { - $credentials['endpoint'] = $endpoint; - } - - $migration->setAttribute('credentials', $credentials); } + if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { + $credentials['endpoint'] = $endpoint; + } + + $migration->setAttribute('credentials', $credentials); + $migration->setAttribute('stage', 'processing'); $migration->setAttribute('status', 'processing'); $this->updateMigrationDocument($migration, $project, $queueForRealtime);