From 11f659b784b98830f4ce3baad22eed6f0ed95b1b Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 16 Oct 2024 21:32:38 +1300 Subject: [PATCH] Add skip relationships exist check --- composer.lock | 12 ++++++------ src/Migration/Destinations/Appwrite.php | 4 ++-- src/Migration/Sources/Appwrite.php | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index a108b22..d0d8c75 100644 --- a/composer.lock +++ b/composer.lock @@ -308,16 +308,16 @@ }, { "name": "utopia-php/database", - "version": "0.53.4", + "version": "0.53.8", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "36a0e89d983afc1368635282e04fa762220a1d2a" + "reference": "f4f9297d633b9f8407c6261535549bfd6024a468" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/36a0e89d983afc1368635282e04fa762220a1d2a", - "reference": "36a0e89d983afc1368635282e04fa762220a1d2a", + "url": "https://api.github.com/repos/utopia-php/database/zipball/f4f9297d633b9f8407c6261535549bfd6024a468", + "reference": "f4f9297d633b9f8407c6261535549bfd6024a468", "shasum": "" }, "require": { @@ -358,9 +358,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.53.4" + "source": "https://github.com/utopia-php/database/tree/0.53.8" }, - "time": "2024-09-10T10:19:57+00:00" + "time": "2024-10-16T08:16:33+00:00" }, { "name": "utopia-php/dsn", diff --git a/src/Migration/Destinations/Appwrite.php b/src/Migration/Destinations/Appwrite.php index a9e96ba..c1990f9 100644 --- a/src/Migration/Destinations/Appwrite.php +++ b/src/Migration/Destinations/Appwrite.php @@ -937,10 +937,10 @@ protected function createDocument(Document $resource, bool $isLast): bool $databaseInternalId = $database->getInternalId(); $collectionInternalId = $collection->getInternalId(); - $this->database->createDocuments( + $this->database->skipRelationshipsExistCheck(fn () => $this->database->createDocuments( 'database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $this->documentBuffer - ); + )); } finally { $this->documentBuffer = []; diff --git a/src/Migration/Sources/Appwrite.php b/src/Migration/Sources/Appwrite.php index ca14951..1d7930f 100644 --- a/src/Migration/Sources/Appwrite.php +++ b/src/Migration/Sources/Appwrite.php @@ -638,7 +638,7 @@ private function exportDocuments(int $batchSize): void $queries[] = Query::cursorAfter($lastDocument); } - $selects = ['*', '$id', '$permissions', '$updatedAt', '$createdAt']; // We want Relations flat! + $selects = ['*', '$id', '$permissions', '$updatedAt', '$createdAt']; // We want relations flat! $manyToMany = []; $attributes = $this->cache->get(Attribute::getName());