From 8ee78137e6428f6ef858a02cb69612a7fff93b72 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 29 Jun 2022 01:07:48 +0200 Subject: [PATCH] fix: internal attribute and index key on migration --- src/Appwrite/Migration/Version/V14.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V14.php b/src/Appwrite/Migration/Version/V14.php index 308850d2c9..6f80bc2e60 100644 --- a/src/Appwrite/Migration/Version/V14.php +++ b/src/Appwrite/Migration/Version/V14.php @@ -583,11 +583,11 @@ class V14 extends Migration break; case 'attributes': case 'indexes': + $internalId = $this->projectDB->getDocument('database_1', $document->getAttribute('collectionId'))->getInternalId(); /** * Add Internal ID 'collectionId' for Subqueries. */ if (!empty($document->getAttribute('collectionId')) && is_null($document->getAttribute('collectionInternalId'))) { - $internalId = $this->projectDB->getDocument('database_1', $document->getAttribute('collectionId'))->getInternalId(); $document->setAttribute('collectionInternalId', $internalId); } /** @@ -608,7 +608,7 @@ class V14 extends Migration * Re-create Collection Document */ $this->projectDB->deleteDocument($document->getCollection(), $document->getId()); - $this->projectDB->createDocument($document->getCollection(), $document->setAttribute('$id', "1_{$document->getInternalId()}_{$document->getAttribute('key')}")); + $this->projectDB->createDocument($document->getCollection(), $document->setAttribute('$id', "1_{$internalId}_{$document->getAttribute('key')}")); } catch (\Throwable $th) { Console::warning("Create Collection Document - {$th->getMessage()}"); }