migration: move filecache index to repair

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/807/merge
Varun Patil 2023-10-06 15:29:16 -07:00
parent 278b2458b3
commit 9f25571704
2 changed files with 13 additions and 9 deletions

View File

@ -17,6 +17,16 @@ class AddMissingIndices
// Should migrate at end
$shouldMigrate = false;
// Speed up CTE lookup for subdirectories
if ($schema->hasTable('filecache')) {
$table = $schema->getTable('filecache');
if (!$table->hasIndex('memories_parent_mimetype')) {
$table->addIndex(['parent', 'mimetype'], 'memories_parent_mimetype');
$shouldMigrate = true;
}
}
// Add index on systemtag_object_mapping to speed up the query
if ($schema->hasTable('systemtag_object_mapping')) {
$table = $schema->getTable('systemtag_object_mapping');

View File

@ -42,15 +42,9 @@ class Version400308Date20221026151748 extends SimpleMigrationStep
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options): ?ISchemaWrapper
{
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
// Speed up CTE lookup for subdirectories
$fileCacheTable = $schema->getTable('filecache');
$fileCacheTable->addIndex(['parent', 'mimetype'], 'memories_parent_mimetype');
// Add other indices
return $schema;
// Addition of memories_parent_mimetype moved to AddMissingIndices
// since this is on an external table (filecache)
return null;
}
/**