Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add new index in repair step instead of on-migrate
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Apr 28, 2023
commit db43d903877a8b90b78cafb404b1e7101bfb2c15
3 changes: 3 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ function (GenericEvent $event) use ($container) {
if (!$table->hasIndex('mounts_class_index')) {
$subject->addHintForMissingSubject($table->getName(), 'mounts_class_index');
}
if (!$table->hasIndex('mounts_user_root_path_index')) {
$subject->addHintForMissingSubject($table->getName(), 'mounts_user_root_path_index');
}
}
}
);
Expand Down
8 changes: 8 additions & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,14 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
$updated = true;
$output->writeln('<info>oc_mounts table updated successfully.</info>');
}
if (!$table->hasIndex('mounts_user_root_path_index')) {
$output->writeln('<info>Adding mounts_user_root_path_index index to the oc_mounts table, this can take some time...</info>');

$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
$this->connection->migrateToSchema($schema->getWrappedSchema());
$updated = true;
$output->writeln('<info>oc_mounts table updated successfully.</info>');
}
}

if (!$updated) {
Expand Down
2 changes: 1 addition & 1 deletion core/Migrations/Version27000Date20220613163520.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$table = $schema->getTable('mounts');
if ($table->hasIndex('mounts_user_root_index')) {
$table->dropIndex('mounts_user_root_index');
$table->addIndex(['user_id', 'root_id', 'mount_point'], 'mounts_user_root_path_index', [], ['lengths' => [null, null, 128]]);
// new index gets added with "add missing indexes"
}

return $schema;
Expand Down