]> source.dussan.org Git - nextcloud-server.git/commitdiff
add new index in repair step instead of on-migrate 32877/head
authorRobin Appelman <robin@icewind.nl>
Thu, 13 Apr 2023 15:19:26 +0000 (17:19 +0200)
committerRobin Appelman <robin@icewind.nl>
Fri, 28 Apr 2023 13:08:08 +0000 (15:08 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
core/Application.php
core/Command/Db/AddMissingIndices.php
core/Migrations/Version27000Date20220613163520.php

index 4ebbada95e6663af147d72cc84257db6d9c78065..2e35461015472005513f6c73a788da716b114b9c 100644 (file)
@@ -239,6 +239,9 @@ class Application extends App {
                                        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');
+                                       }
                                }
                        }
                );
index e22d0fddeca34740499e83cb767481e405a5f28f..b317f44b499303e1133ab2226cfd2f91d039672e 100644 (file)
@@ -465,6 +465,14 @@ class AddMissingIndices extends Command {
                                $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) {
index 5f327e69c964af8157ee6e27bc91cb100d1f912b..4217f3b3270aa0ada490efda6e94d09aa0ee79c0 100644 (file)
@@ -43,7 +43,7 @@ class Version27000Date20220613163520 extends SimpleMigrationStep {
                $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;