mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge branch '0.10.x' of https://github.com/appwrite/appwrite into feat-265-realtime
This commit is contained in:
commit
c85cfb66d2
12 files changed
+300
-132
No files matched your search
@@ -43,7 +43,7 @@ abstract class Migration
|
||||
'0.9.2' => 'V08',
|
||||
'0.9.3' => 'V08',
|
||||
'0.9.4' => 'V08',
|
||||
'0.10.0' => 'V08',
|
||||
'0.10.0' => 'V09',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Migration\Version;
|
||||
|
||||
use Appwrite\Migration\Migration;
|
||||
use Utopia\CLI\Console;
|
||||
use Appwrite\Database\Database;
|
||||
use Appwrite\Database\Document;
|
||||
|
||||
class V09 extends Migration
|
||||
{
|
||||
public function execute(): void
|
||||
{
|
||||
$project = $this->project;
|
||||
Console::log('Migrating project: ' . $project->getAttribute('name') . ' (' . $project->getId() . ')');
|
||||
|
||||
$this->forEachDocument([$this, 'fixDocument']);
|
||||
}
|
||||
|
||||
protected function fixDocument(Document $document)
|
||||
{
|
||||
switch ($document->getAttribute('$collection')) {
|
||||
/**
|
||||
* Add version reference to database.
|
||||
*/
|
||||
case Database::SYSTEM_COLLECTION_PROJECTS:
|
||||
$document->setAttribute('version', '0.10.0');
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($document as &$attr) {
|
||||
if ($attr instanceof Document) {
|
||||
$attr = $this->fixDocument($attr);
|
||||
}
|
||||
|
||||
if (\is_array($attr)) {
|
||||
foreach ($attr as &$child) {
|
||||
if ($child instanceof Document) {
|
||||
$child = $this->fixDocument($child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $document;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user