mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Merge pull request #5356 from appwrite/fix-migration-v18
fix: migration for 1.3.x
This commit is contained in:
commit
7cec672a63
4 changed files with 5 additions and 7 deletions
|
|
@ -1356,7 +1356,7 @@ App::get('/v1/account/prefs')
|
|||
->inject('user')
|
||||
->action(function (Response $response, Document $user) {
|
||||
|
||||
$prefs = $user->getAttribute('prefs', new \stdClass());
|
||||
$prefs = $user->getAttribute('prefs', []);
|
||||
|
||||
$response->dynamic(new Document($prefs), Response::MODEL_PREFERENCES);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ App::get('/v1/teams/:teamId/prefs')
|
|||
throw new Exception(Exception::TEAM_NOT_FOUND);
|
||||
}
|
||||
|
||||
$prefs = $team->getAttribute('prefs', new \stdClass());
|
||||
$prefs = $team->getAttribute('prefs', []);
|
||||
|
||||
$response->dynamic(new Document($prefs), Response::MODEL_PREFERENCES);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ App::get('/v1/users/:userId/prefs')
|
|||
throw new Exception(Exception::USER_NOT_FOUND);
|
||||
}
|
||||
|
||||
$prefs = $user->getAttribute('prefs', new \stdClass());
|
||||
$prefs = $user->getAttribute('prefs', []);
|
||||
|
||||
$response->dynamic(new Document($prefs), Response::MODEL_PREFERENCES);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ class V18 extends Migration
|
|||
$this->migrateCollections();
|
||||
|
||||
Console::info('Migrating Documents');
|
||||
$this->forEachDocument(function (Document $document) {
|
||||
$this->migrateDocument($document);
|
||||
});
|
||||
$this->forEachDocument([$this, 'fixDocument']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -131,7 +129,7 @@ class V18 extends Migration
|
|||
* @param Document $document
|
||||
* @return Document
|
||||
*/
|
||||
private function migrateDocument(Document $document): Document
|
||||
protected function fixDocument(Document $document): Document
|
||||
{
|
||||
switch ($document->getCollection()) {
|
||||
case 'projects':
|
||||
|
|
|
|||
Loading…
Reference in a new issue