aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-06-22 11:21:06 +0200
committerGitHub <noreply@github.com>2023-06-22 11:21:06 +0200
commit618c3a4817cf3180d760c191623a515ded39f520 (patch)
tree7474cd68d3e349667206e1da0acbb47123eaca87
parenta3fe1adb03ad5814298e4f18d14d98f85096fe7c (diff)
parente7747084828c2f7fbc4e4dc0f03191955fc71ee9 (diff)
downloadnextcloud-server-618c3a4817cf3180d760c191623a515ded39f520.tar.gz
nextcloud-server-618c3a4817cf3180d760c191623a515ded39f520.zip
Merge pull request #38928 from nextcloud/fix/missing-systemtags-index
-rw-r--r--core/Application.php7
-rw-r--r--core/Command/Db/AddMissingIndices.php13
-rw-r--r--core/Migrations/Version13000Date20170718121200.php1
3 files changed, 21 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php
index 2e354610154..592e0929666 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -243,6 +243,13 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'mounts_user_root_path_index');
}
}
+
+ if ($schema->hasTable('systemtag_object_mapping')) {
+ $table = $schema->getTable('systemtag_object_mapping');
+ if (!$table->hasIndex('systag_by_tagid')) {
+ $subject->addHintForMissingSubject($table->getName(), 'systag_by_tagid');
+ }
+ }
}
);
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 4f8e0c45a35..62109867913 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -472,6 +472,19 @@ class AddMissingIndices extends Command {
}
}
+ $output->writeln('<info>Check indices of the oc_systemtag_object_mapping table.</info>');
+ if ($schema->hasTable('oc_systemtag_object_mapping')) {
+ $table = $schema->getTable('oc_systemtag_object_mapping');
+ if (!$table->hasIndex('systag_by_tagid')) {
+ $output->writeln('<info>Adding systag_by_tagid index to the oc_systemtag_object_mapping table, this can take some time...</info>');
+
+ $table->addIndex(['systemtagid', 'objecttype'], 'systag_by_tagid');
+ $this->connection->migrateToSchema($schema->getWrappedSchema());
+ $updated = true;
+ $output->writeln('<info>oc_systemtag_object_mapping table updated successfully.</info>');
+ }
+ }
+
if (!$updated) {
$output->writeln('<info>Done.</info>');
}
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php
index 34a249814fb..05cdbcfd6b5 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -754,6 +754,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['objecttype', 'objectid', 'systemtagid'], 'som_pk');
// $table->addUniqueIndex(['objecttype', 'objectid', 'systemtagid'], 'mapping');
+ $table->addIndex(['systemtagid', 'objecttype'], 'systag_by_tagid');
}
if (!$schema->hasTable('systemtag_group')) {