Browse Source

Check and add index on principaluri for schedulingobjects table

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
tags/v18.0.0beta1
Thomas Citharel 4 years ago
parent
commit
68cf47e947
No account linked to committer's email address
2 changed files with 20 additions and 0 deletions
  1. 7
    0
      core/Application.php
  2. 13
    0
      core/Command/Db/AddMissingIndices.php

+ 7
- 0
core/Application.php View File

@@ -153,6 +153,13 @@ class Application extends App {
$subject->addHintForMissingSubject($table->getName(), 'calendarobject_calid_index');
}
}

if ($schema->hasTable('schedulingobjects')) {
$table = $schema->getTable('schedulingobjects');
if (!$table->hasIndex('schedulobj_principuri_index')) {
$subject->addHintForMissingSubject($table->getName(), 'schedulobj_principuri_index');
}
}
}
);


+ 13
- 0
core/Command/Db/AddMissingIndices.php View File

@@ -234,6 +234,19 @@ class AddMissingIndices extends Command {
}
}

$output->writeln('<info>Check indices of the schedulingobjects table.</info>');
if ($schema->hasTable('schedulingobjects')) {
$table = $schema->getTable('schedulingobjects');
if (!$table->hasIndex('schedulobj_principuri_index')) {
$output->writeln('<info>Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...</info>');

$table->addIndex(['principaluri'], 'schedulobj_principuri_index');
$this->connection->migrateToSchema($schema->getWrappedSchema());
$updated = true;
$output->writeln('<info>schedulingobjects table updated successfully.</info>');
}
}

if (!$updated) {
$output->writeln('<info>Done.</info>');
}

Loading…
Cancel
Save