From f65441fb833ec7d9349093bb95e785d7f07d4838 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 30 Dec 2021 10:59:58 +0100 Subject: [PATCH] fix: migration dont stop on exception --- src/Appwrite/Migration/Version/V11.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Migration/Version/V11.php b/src/Appwrite/Migration/Version/V11.php index 7df26f8d9..6a706309e 100644 --- a/src/Appwrite/Migration/Version/V11.php +++ b/src/Appwrite/Migration/Version/V11.php @@ -202,7 +202,7 @@ class V11 extends Migration $this->dbProject->createDocument($new->getCollection(), $new); } } catch (\Throwable $th) { - Console::error('Failed to update document: ' . $th->getMessage()); + Console::error("Failed to migrate document ({$new->getId()}) from collection ({$new->getCollection()}): " . $th->getMessage()); continue; } } @@ -394,7 +394,13 @@ class V11 extends Migration }, $document); $document = new Document($document->getArrayCopy()); $document = $this->migratePermissions($document); - $this->dbProject->createDocument('collection_' . $collection, $document); + + try { + $this->dbProject->createDocument('collection_' . $collection, $document); + } catch (\Throwable $th) { + Console::error("Failed to migrate document ({$document->getId()}): " . $th->getMessage()); + continue; + } } $offset += $this->limit; }