diff --git a/src/Appwrite/Migration/Version/V11.php b/src/Appwrite/Migration/Version/V11.php index 6a706309e7..bf9b7ea101 100644 --- a/src/Appwrite/Migration/Version/V11.php +++ b/src/Appwrite/Migration/Version/V11.php @@ -510,6 +510,29 @@ class V11 extends Migration break; case OldDatabase::SYSTEM_COLLECTION_KEYS: + $projectId = $this->getProjectIdFromReadPermissions($document); + + /** + * Set Project ID + */ + if ($document->getAttribute('projectId') === null) { + $document->setAttribute('projectId', $projectId); + } + + /** + * Set scopes if empty + */ + if (empty($document->getAttribute('scopes', []))) { + $document->setAttribute('scopes', []); + } + + /** + * Reset Permissions + */ + $document->setAttribute('$read', ['role:all']); + $document->setAttribute('$write', ['role:all']); + + break; case OldDatabase::SYSTEM_COLLECTION_WEBHOOKS: $projectId = $this->getProjectIdFromReadPermissions($document);