Skip to content

Commit 7710ea2

Browse files
authored
Merge pull request #34798 from nextcloud/backport/33405/stable24
2 parents 1524b5f + 67af99e commit 7710ea2

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

core/Application.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ function (GenericEvent $event) use ($container) {
218218
$subject->addHintForMissingSubject($table->getName(), 'direct_edit_timestamp');
219219
}
220220
}
221+
222+
if ($schema->hasTable('mounts')) {
223+
$table = $schema->getTable('mounts');
224+
if (!$table->hasIndex('mounts_class_index')) {
225+
$subject->addHintForMissingSubject($table->getName(), 'mounts_class_index');
226+
}
227+
}
221228
}
222229
);
223230

core/Command/Db/AddMissingIndices.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,22 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
435435
}
436436
}
437437

438+
$output->writeln('<info>Check indices of the oc_mounts table.</info>');
439+
if ($schema->hasTable('mounts')) {
440+
$table = $schema->getTable('mounts');
441+
if (!$table->hasIndex('mounts_class_index')) {
442+
$output->writeln('<info>Adding mounts_class_index index to the oc_mounts table, this can take some time...</info>');
443+
444+
$table->addIndex(['mount_provider_class'], 'mounts_class_index');
445+
$sqlQueries = $this->connection->migrateToSchema($schema->getWrappedSchema(), $dryRun);
446+
if ($dryRun && $sqlQueries !== null) {
447+
$output->writeln($sqlQueries);
448+
}
449+
$updated = true;
450+
$output->writeln('<info>oc_mounts table updated successfully.</info>');
451+
}
452+
}
453+
438454
if (!$updated) {
439455
$output->writeln('<info>Done.</info>');
440456
}

core/Migrations/Version24000Date20220202150027.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3030
'notnull' => false,
3131
'length' => 128,
3232
]);
33+
$table->addIndex(['mount_provider_class'], 'mounts_class_index');
3334
return $schema;
3435
}
3536
return null;

0 commit comments

Comments
 (0)