fix: migration speed
This commit is contained in:
parent
f240a11c54
commit
d36e5b0167
1 changed files with 16 additions and 3 deletions
|
@ -5,6 +5,7 @@ namespace Appwrite\Migration\Version;
|
||||||
use Appwrite\Migration\Migration;
|
use Appwrite\Migration\Migration;
|
||||||
use Utopia\App;
|
use Utopia\App;
|
||||||
use Utopia\CLI\Console;
|
use Utopia\CLI\Console;
|
||||||
|
use Utopia\Database\Database;
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
|
|
||||||
class V14 extends Migration
|
class V14 extends Migration
|
||||||
|
@ -19,6 +20,13 @@ class V14 extends Migration
|
||||||
global $register;
|
global $register;
|
||||||
$this->pdo = $register->get('db');
|
$this->pdo = $register->get('db');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable SubQueries for Speed.
|
||||||
|
*/
|
||||||
|
foreach (['subQueryAttributes', 'subQueryIndexes', 'subQueryPlatforms', 'subQueryDomains', 'subQueryKeys', 'subQueryWebhooks', 'subQuerySessions', 'subQueryTokens', 'subQueryMemberships'] as $name) {
|
||||||
|
Database::addFilter($name, fn () => null, fn () => []);
|
||||||
|
}
|
||||||
|
|
||||||
Console::log('Migrating project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')');
|
Console::log('Migrating project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')');
|
||||||
Console::info('Migrating Collections');
|
Console::info('Migrating Collections');
|
||||||
$this->migrateCollections();
|
$this->migrateCollections();
|
||||||
|
@ -40,9 +48,14 @@ class V14 extends Migration
|
||||||
*/
|
*/
|
||||||
public function createDatabaseLayer(): void
|
public function createDatabaseLayer(): void
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if (!$this->projectDB->exists('databases')) {
|
if (!$this->projectDB->exists('databases')) {
|
||||||
$this->createCollection('databases');
|
$this->createCollection('databases');
|
||||||
}
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
Console::warning($th->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($this->project->getId() === 'console') {
|
if ($this->project->getId() === 'console') {
|
||||||
return;
|
return;
|
||||||
|
@ -649,7 +662,7 @@ class V14 extends Migration
|
||||||
if (is_null($document->getAttribute('phoneVerification'))) {
|
if (is_null($document->getAttribute('phoneVerification'))) {
|
||||||
$document->setAttribute('phoneVerification', false);
|
$document->setAttribute('phoneVerification', false);
|
||||||
}
|
}
|
||||||
|
var_dump($document->getArrayCopy());
|
||||||
break;
|
break;
|
||||||
case 'functions':
|
case 'functions':
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue