Skip to content

Commit f790fcf

Browse files
add new index in repair step instead of on-migrate
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 4c87244 commit f790fcf

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

core/Application.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ function (GenericEvent $event) use ($container) {
239239
if (!$table->hasIndex('mounts_class_index')) {
240240
$subject->addHintForMissingSubject($table->getName(), 'mounts_class_index');
241241
}
242+
if (!$table->hasIndex('mounts_user_root_path_index')) {
243+
$subject->addHintForMissingSubject($table->getName(), 'mounts_user_root_path_index');
244+
}
242245
}
243246
}
244247
);

core/Command/Db/AddMissingIndices.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,14 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
465465
$updated = true;
466466
$output->writeln('<info>oc_mounts table updated successfully.</info>');
467467
}
468+
if (!$table->hasIndex('mounts_user_root_path_index')) {
469+
$output->writeln('<info>Adding mounts_user_root_path_index index to the oc_mounts table, this can take some time...</info>');
470+
471+
$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
472+
$this->connection->migrateToSchema($schema->getWrappedSchema());
473+
$updated = true;
474+
$output->writeln('<info>oc_mounts table updated successfully.</info>');
475+
}
468476
}
469477

470478
if (!$updated) {

core/Migrations/Version27000Date20220613163520.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4343
$table = $schema->getTable('mounts');
4444
if ($table->hasIndex('mounts_user_root_index')) {
4545
$table->dropIndex('mounts_user_root_index');
46-
$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
46+
// new index gets added with "add missing indexes"
4747
}
4848

4949
return $schema;

0 commit comments

Comments
 (0)