diff --git a/src/Appwrite/Migration/Version/V25.php b/src/Appwrite/Migration/Version/V25.php index 759a3d0794..05b1142be2 100644 --- a/src/Appwrite/Migration/Version/V25.php +++ b/src/Appwrite/Migration/Version/V25.php @@ -200,13 +200,13 @@ class V25 extends Migration } if ( - $document->getAttribute('parentResourceInternalId', '') === '' + (string) $document->getAttribute('parentResourceInternalId', '') === '' && isset($internalIds['parentResourceInternalId']) ) { $document->setAttribute('parentResourceInternalId', $internalIds['parentResourceInternalId']); } if ( - $document->getAttribute('resourceInternalId', '') === '' + (string) $document->getAttribute('resourceInternalId', '') === '' && isset($internalIds['resourceInternalId']) ) { $document->setAttribute('resourceInternalId', $internalIds['resourceInternalId']); diff --git a/tests/unit/Migration/Version/V25Test.php b/tests/unit/Migration/Version/V25Test.php index d95805a13c..fadb5609e0 100644 --- a/tests/unit/Migration/Version/V25Test.php +++ b/tests/unit/Migration/Version/V25Test.php @@ -33,7 +33,9 @@ final class V25Test extends TestCase '$id' => 'migration', '$collection' => 'migrations', 'resourceId' => 'database:collection', + 'resourceInternalId' => null, 'resourceType' => Resource::TYPE_DATABASE, + 'parentResourceInternalId' => null, ]); $result = $migration->migrate($document); @@ -84,7 +86,9 @@ final class V25Test extends TestCase '$id' => 'migration', '$collection' => 'migrations', 'resourceId' => 'database:collection', + 'resourceInternalId' => null, 'resourceType' => Resource::TYPE_DATABASE, + 'parentResourceInternalId' => null, ]); $migration->migrate($document);