Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable25] fix(systemtags): Add missing systemtags index #38962

Merged
merged 3 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ function (GenericEvent $event) use ($container) {
$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');
}
}
}
);

Expand Down
13 changes: 13 additions & 0 deletions core/Command/Db/AddMissingIndices.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,19 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
}
}

$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>');
}
Expand Down
1 change: 1 addition & 0 deletions core/Migrations/Version13000Date20170718121200.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
]);
$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')) {
Expand Down
Loading