Merge pull request #38960 from nextcloud/fix/missing-systemtags-index-stable27

[stable27] fix(systemtags): Add missing systemtags index
This commit is contained in:
Joas Schilling 2023-07-11 07:23:07 +02:00 committed by GitHub
commit b43e45d3c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View file

@ -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');
}
}
}
);

View file

@ -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>');
}

View file

@ -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')) {