From 852eb43585ca1b3949fa414d53884c3792dc8ea9 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy Date: Mon, 25 May 2026 08:01:14 +0100 Subject: [PATCH] Scope source-resolution block to Appwrite sources only --- src/Appwrite/Platform/Workers/Migrations.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index eda00c6de7..b5d0737281 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -198,15 +198,15 @@ class Migrations extends Action /** @var Database|null $projectDB */ $projectDB = null; $useAppwriteApiSource = false; - if ($source === SourceAppwrite::getName() && empty($credentials['projectId'])) { + $isAppwriteSource = $source === SourceAppwrite::getName(); + $isAppwriteToAppwrite = $isAppwriteSource + && $destination === DestinationAppwrite::getName(); + + if ($isAppwriteSource && empty($credentials['projectId'])) { throw new Exception(Exception::MIGRATION_SOURCE_PROJECT_ID_REQUIRED); } - if (! empty($credentials['projectId'])) { - $isAppwriteSource = $source === SourceAppwrite::getName(); - $isAppwriteToAppwrite = $isAppwriteSource - && $destination === DestinationAppwrite::getName(); - + if ($isAppwriteSource) { $this->sourceProject = $this->dbForPlatform->getDocument('projects', $credentials['projectId']); // Same projectId may collide with an external Appwrite — trust the DB fast @@ -242,7 +242,7 @@ class Migrations extends Action $destinationRegion = $this->project->getAttribute('region', 'default'); $isLocalSource = !$this->sourceProject->isEmpty() - && (!$isAppwriteSource || $isLocalEndpoint) + && $isLocalEndpoint && (!$isAppwriteToAppwrite || $sourceRegion === $destinationRegion); if ($isLocalSource) {