From c7929572f3459a6edba9b4796b85374f45df2a58 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Sat, 2 Sep 2023 22:45:37 -0700 Subject: [PATCH] Fix builds migration --- src/Appwrite/Migration/Version/V19.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index e7cef65738..49cfd687bb 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -190,16 +190,23 @@ class V19 extends Migration break; case 'builds': - try { - $this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId'); - } catch (\Throwable $th) { - Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}"); + $attributesToCreate = [ + 'size', + 'deploymentInternalId', + 'logs', + ]; + foreach ($attributesToCreate as $attribute) { + try { + $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + } catch (\Throwable $th) { + Console::warning("$attribute from {$id}: {$th->getMessage()}"); + } } try { - $this->createAttributeFromCollection($this->projectDB, $id, 'logs'); + $this->projectDB->renameAttribute($id, 'outputPath', 'path'); } catch (\Throwable $th) { - Console::warning("'logs' from {$id}: {$th->getMessage()}"); + Console::warning("'path' from {$id}: {$th->getMessage()}"); } $this->projectDB->deleteCachedCollection($id); @@ -209,13 +216,13 @@ class V19 extends Migration try { $this->projectDB->renameAttribute($id, 'log', 'logs'); } catch (\Throwable $th) { - Console::warning("'errors' from {$id}: {$th->getMessage()}"); + Console::warning("'logs' from {$id}: {$th->getMessage()}"); } try { $this->projectDB->updateAttribute($id, 'logs', size: 1000000); } catch (\Throwable $th) { - Console::warning("'errors' from {$id}: {$th->getMessage()}"); + Console::warning("'logs' from {$id}: {$th->getMessage()}"); } $this->projectDB->deleteCachedCollection($id);