fix: internal id twice

This commit is contained in:
Torsten Dittmann 2022-06-29 12:31:11 +02:00
parent 8ee78137e6
commit 7028bc1415

View file

@ -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);
}
/**
@ -607,6 +607,7 @@ class V14 extends Migration
/**
* Re-create Collection Document
*/
$internalId = $this->projectDB->getDocument('database_1', $document->getAttribute('collectionId'))->getInternalId();
$this->projectDB->deleteDocument($document->getCollection(), $document->getId());
$this->projectDB->createDocument($document->getCollection(), $document->setAttribute('$id', "1_{$internalId}_{$document->getAttribute('key')}"));
} catch (\Throwable $th) {