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

pull/38948/head
Marcel Klehr 2023-06-22 11:21:06 +07:00 committed by GitHub
commit 618c3a4817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

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

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

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