diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 15c14daf51..e3a2021c1a 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -239,7 +239,7 @@ abstract class Migration } /** - * Creates colletion from the config collection. + * Creates collection from the config collection. * * @param string $id * @param string|null $name @@ -266,6 +266,7 @@ abstract class Migration 'type' => $attribute['type'], 'size' => $attribute['size'], 'required' => $attribute['required'], + 'default' => $attribute['default'] ?? null, 'signed' => $attribute['signed'], 'array' => $attribute['array'], 'filters' => $attribute['filters'], diff --git a/src/Appwrite/Migration/Version/V20.php b/src/Appwrite/Migration/Version/V20.php index 1a599d32f2..5a0807cedf 100644 --- a/src/Appwrite/Migration/Version/V20.php +++ b/src/Appwrite/Migration/Version/V20.php @@ -336,6 +336,32 @@ class V20 extends Migration Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } + break; + case 'topics': + try { + $this->projectDB->updateAttributeDefault($id, 'emailTotal', 0); + } catch (Throwable $th) { + Console::warning("'topics' from {$id}: {$th->getMessage()}"); + } + + try { + $this->projectDB->updateAttributeDefault($id, 'pushTotal', 0); + } catch (Throwable $th) { + Console::warning("'topics' from {$id}: {$th->getMessage()}"); + } + + try { + $this->projectDB->updateAttributeDefault($id, 'smsTotal', 0); + } catch (Throwable $th) { + Console::warning("'topics' from {$id}: {$th->getMessage()}"); + } + + try { + $this->projectDB->purgeCachedCollection($id); + } catch (Throwable $th) { + Console::warning("Purge cache from {$id}: {$th->getMessage()}"); + } + break; }