mirror of
https://github.com/appwrite/appwrite
synced 2026-04-21 13:37:16 +00:00
updated
This commit is contained in:
parent
8de7b41929
commit
62f7f25cb5
1 changed files with 16 additions and 10 deletions
|
|
@ -196,17 +196,23 @@ class Migrations extends Action
|
|||
/** @var Database|null $projectDB */
|
||||
$projectDB = null;
|
||||
$useAppwriteApiSource = false;
|
||||
if ($credentials['projectId']) {
|
||||
if ($source === SourceAppwrite::getName() && empty($credentials['projectId'])) {
|
||||
throw new \Exception('Source projectId is required for Appwrite migrations');
|
||||
}
|
||||
|
||||
if (! empty($credentials['projectId'])) {
|
||||
$this->sourceProject = $this->dbForPlatform->getDocument('projects', $credentials['projectId']);
|
||||
if (! $this->sourceProject->isEmpty()) {
|
||||
$sourceRegion = $this->sourceProject->getAttribute('region', 'default');
|
||||
$destinationRegion = $this->project->getAttribute('region', 'default');
|
||||
$useAppwriteApiSource = $source === SourceAppwrite::getName()
|
||||
&& $destination === DestinationAppwrite::getName()
|
||||
&& $sourceRegion !== $destinationRegion;
|
||||
if (! $useAppwriteApiSource) {
|
||||
$projectDB = call_user_func($this->getProjectDB, $this->sourceProject);
|
||||
}
|
||||
if ($this->sourceProject->isEmpty()) {
|
||||
throw new \Exception('Source project not found for provided projectId');
|
||||
}
|
||||
|
||||
$sourceRegion = $this->sourceProject->getAttribute('region', 'default');
|
||||
$destinationRegion = $this->project->getAttribute('region', 'default');
|
||||
$useAppwriteApiSource = $source === SourceAppwrite::getName()
|
||||
&& $destination === DestinationAppwrite::getName()
|
||||
&& $sourceRegion !== $destinationRegion;
|
||||
if (! $useAppwriteApiSource) {
|
||||
$projectDB = call_user_func($this->getProjectDB, $this->sourceProject);
|
||||
}
|
||||
}
|
||||
$getDatabasesDB = fn (Document $database): Database =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue