From d41ee76d3621908d7480b47a748bd5b8fa6953dc Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 14 Jan 2021 14:12:55 +0100 Subject: [PATCH] fix(migration): prepare filter migration --- src/Appwrite/Migration/Version/V06.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Migration/Version/V06.php b/src/Appwrite/Migration/Version/V06.php index d28d3b652b..b9a253701c 100644 --- a/src/Appwrite/Migration/Version/V06.php +++ b/src/Appwrite/Migration/Version/V06.php @@ -3,6 +3,7 @@ namespace Appwrite\Migration\Version; use Utopia\CLI\Console; +use Utopia\Config\Config; use Appwrite\Database\Database; use Appwrite\Database\Document; use Appwrite\Migration\Migration; @@ -13,12 +14,13 @@ class V06 extends Migration { Console::log('I got nothing to do. Yet.'); - //TODO: migrate new `filter` property $this->forEachDocument([$this, 'fixDocument']); } protected function fixDocument(Document $document) { + $providers = Config::getParam('providers'); + switch ($document->getAttribute('$collection')) { case Database::SYSTEM_COLLECTION_USERS: if ($document->getAttribute('password-update', null)) { @@ -26,6 +28,26 @@ class V06 extends Migration ->setAttribute('passwordUpdate', $document->getAttribute('password-update', $document->getAttribute('passwordUpdate', ''))) ->removeAttribute('password-update'); } + if($document->getAttribute('prefs', null)) { + //TODO: take care of filter ['json'] + } + break; + case Database::SYSTEM_COLLECTION_WEBHOOKS: + if($document->getAttribute('httpPass', null)) { + //TODO: take care of filter ['encrypt'] + } + break; + case Database::SYSTEM_COLLECTION_TASKS: + if($document->getAttribute('httpPass', null)) { + //TODO: take care of filter ['encrypt'] + } + break; + case Database::SYSTEM_COLLECTION_PROJECTS: + foreach ($providers as $key => $provider) { + if ($document->getAttribute('usersOauth' . \ucfirst($key) . 'Secret')) { + //TODO: take care of filter ['encrypt] + } + } break; } return $document;