mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Merge pull request #4915 from appwrite/fix-1.2.x-migration
Fix: 1.2.x migration
This commit is contained in:
commit
fa969dedbc
1 changed files with 24 additions and 14 deletions
|
|
@ -27,11 +27,34 @@ class V17 extends Migration
|
||||||
|
|
||||||
Console::info('Migrating Collections');
|
Console::info('Migrating Collections');
|
||||||
$this->migrateCollections();
|
$this->migrateCollections();
|
||||||
|
Console::info('Migrating Buckets');
|
||||||
|
$this->migrateBuckets();
|
||||||
Console::info('Migrating Documents');
|
Console::info('Migrating Documents');
|
||||||
$this->forEachDocument([$this, 'fixDocument']);
|
$this->forEachDocument([$this, 'fixDocument']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrating all Bucket tables.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \Exception
|
||||||
|
* @throws \PDOException
|
||||||
|
*/
|
||||||
|
protected function migrateBuckets(): void
|
||||||
|
{
|
||||||
|
foreach ($this->documentsIterator('buckets') as $bucket) {
|
||||||
|
$id = "bucket_{$bucket->getInternalId()}";
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false);
|
||||||
|
$this->projectDB->deleteCachedCollection($id);
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Migrate all Collections.
|
* Migrate all Collections.
|
||||||
*
|
*
|
||||||
|
|
@ -47,19 +70,6 @@ class V17 extends Migration
|
||||||
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
|
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
|
||||||
|
|
||||||
switch ($id) {
|
switch ($id) {
|
||||||
case 'files':
|
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* Update 'mimeType' attribute size (127->255)
|
|
||||||
*/
|
|
||||||
$this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false);
|
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue