diff --git a/src/Appwrite/Migration/Version/V20.php b/src/Appwrite/Migration/Version/V20.php index d8a333ccf4..e88f42062b 100644 --- a/src/Appwrite/Migration/Version/V20.php +++ b/src/Appwrite/Migration/Version/V20.php @@ -118,6 +118,25 @@ class V20 extends Migration case 'schedules': $document->setAttribute('resourceCollection', 'functions'); break; + case 'users': + if ($document->getAttribute('email', '') !== '') { + $document->setAttribute('targets', [ + 'userId' => $document->getId(), + 'userInternalId' => $document->getInternalId(), + 'providerType' => MESSAGE_TYPE_EMAIL, + 'identifier' => $document->getAttribute('email'), + ]); + } + + if ($document->getAttribute('phone', '') !== '') { + $document->setAttribute('targets', [ + 'userId' => $document->getId(), + 'userInternalId' => $document->getInternalId(), + 'providerType' => MESSAGE_TYPE_SMS, + 'identifier' => $document->getAttribute('phone'), + ]); + } + break; } return $document; }