mirror of
https://github.com/appwrite/appwrite
synced 2026-05-08 09:41:32 +00:00
fix: files migration
This commit is contained in:
parent
8c056706de
commit
e6c986d3fb
1 changed files with 23 additions and 0 deletions
|
|
@ -175,6 +175,29 @@ class V12 extends Migration
|
|||
]));
|
||||
$this->createCollection('files', 'bucket_1');
|
||||
|
||||
$nextDocument = null;
|
||||
do {
|
||||
$documents = $this->projectDB->find('files', limit: $this->limit, cursor: $nextDocument);
|
||||
$count = count($documents);
|
||||
\Co\run(function (array $documents) {
|
||||
foreach ($documents as $document) {
|
||||
go(function (Document $document) {
|
||||
$document
|
||||
->setAttribute('bucketId', 'default')
|
||||
->setAttribute('chunksTotal', 1)
|
||||
->setAttribute('chunksUploaded', 1);
|
||||
$this->projectDB->createDocument('bucket_1', $document);
|
||||
}, $document);
|
||||
}
|
||||
}, $documents);
|
||||
|
||||
if ($count !== $this->limit) {
|
||||
$nextDocument = null;
|
||||
} else {
|
||||
$nextDocument = end($documents);
|
||||
}
|
||||
} while (!is_null($nextDocument));
|
||||
|
||||
/**
|
||||
* Rename folder on volumes.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue