mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Add console
This commit is contained in:
parent
be400681e7
commit
c56dba6b20
1 changed files with 14 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ namespace Appwrite\Platform\Tasks;
|
|||
|
||||
use Appwrite\Migration\Migration;
|
||||
use Redis;
|
||||
use Utopia\App;
|
||||
use Utopia\CLI\Console;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Document;
|
||||
|
|
@ -64,7 +65,7 @@ class Migrate extends Action
|
|||
$migration = new $class();
|
||||
|
||||
$count = 0;
|
||||
$total = $dbForPlatform->count('projects');
|
||||
$total = $dbForPlatform->count('projects') + 1;
|
||||
|
||||
$dbForPlatform->foreach('projects', function (Document $project) use ($dbForPlatform, $getProjectDB, $register, $migration, &$count, $total) {
|
||||
/** @var Database $dbForProject */
|
||||
|
|
@ -84,6 +85,18 @@ class Migrate extends Action
|
|||
Console::log('Migrated ' . ++$count . '/' . $total . ' projects...');
|
||||
});
|
||||
|
||||
$console = (new App('UTC'))->getResource('console');
|
||||
|
||||
try {
|
||||
$migration
|
||||
->setProject($console, $getProjectDB($console), $dbForPlatform)
|
||||
->setPDO($register->get('db', true))
|
||||
->execute();
|
||||
} catch (\Throwable $th) {
|
||||
Console::error('Failed to migrate project "console" with error: ' . $th->getMessage());
|
||||
throw $th;
|
||||
}
|
||||
|
||||
Console::success('Migration completed');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue