1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00

fix(migration): prepare filter migration

This commit is contained in:
Torsten Dittmann 2021-01-14 14:12:55 +01:00
parent bc71a1868b
commit d41ee76d36

View file

@ -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;