diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-07-11 07:23:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-11 07:23:07 +0200 |
commit | b43e45d3c2dabd573a5a519ea96b6a33f38fe759 (patch) | |
tree | 6e9387234c0142156385b361ba318082e4a6cad0 /core | |
parent | e211096573b50391d78dcf1b2ea935d327cfe9c3 (diff) | |
parent | 7226a9a5600b7409720c49c11c449d5f56c9f11e (diff) | |
download | nextcloud-server-b43e45d3c2dabd573a5a519ea96b6a33f38fe759.tar.gz nextcloud-server-b43e45d3c2dabd573a5a519ea96b6a33f38fe759.zip |
Merge pull request #38960 from nextcloud/fix/missing-systemtags-index-stable27
[stable27] fix(systemtags): Add missing systemtags index
Diffstat (limited to 'core')
-rw-r--r-- | core/Application.php | 7 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 13 | ||||
-rw-r--r-- | core/Migrations/Version13000Date20170718121200.php | 1 |
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 b317f44b499..452bcbad5dc 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -475,6 +475,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')) { |