diff --git a/core/Application.php b/core/Application.php
index a65f1f3fa602b..94990df935686 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -85,6 +85,14 @@ function(GenericEvent $event) use ($container) {
$subject->addHintForMissingSubject($table->getName(), 'fs_mtime');
}
}
+
+ if ($schema->hasTable('twofactor_providers')) {
+ $table = $schema->getTable('twofactor_providers');
+
+ if (!$table->hasIndex('twofactor_providers_uid')) {
+ $subject->addHintForMissingSubject($table->getName(), 'twofactor_providers_uid');
+ }
+ }
}
);
}
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 8fb5f9b4e8814..3bc66988529e9 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -61,7 +61,7 @@ protected function configure() {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- $this->addShareTableIndicies($output);
+ $this->addCoreIndexes($output);
// Dispatch event so apps can also update indexes if needed
$event = new GenericEvent($output);
@@ -74,7 +74,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
* @param OutputInterface $output
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
- private function addShareTableIndicies(OutputInterface $output) {
+ private function addCoreIndexes(OutputInterface $output) {
$output->writeln('Check indices of the share table.');
@@ -116,6 +116,7 @@ private function addShareTableIndicies(OutputInterface $output) {
}
}
+ $output->writeln('Check indices of the filecache table.');
if ($schema->hasTable('filecache')) {
$table = $schema->getTable('filecache');
if (!$table->hasIndex('fs_mtime')) {
@@ -127,6 +128,18 @@ private function addShareTableIndicies(OutputInterface $output) {
}
}
+ $output->writeln('Check indices of the twofactor_providers table.');
+ if ($schema->hasTable('twofactor_providers')) {
+ $table = $schema->getTable('twofactor_providers');
+ if (!$table->hasIndex('twofactor_providers_uid')) {
+ $output->writeln('Adding additional twofactor_providers_uid index to the twofactor_providers table, this can take some time...');
+ $table->addIndex(['uid'], 'twofactor_providers_uid');
+ $this->connection->migrateToSchema($schema->getWrappedSchema());
+ $updated = true;
+ $output->writeln('Twofactor_providers table updated successfully.');
+ }
+ }
+
if (!$updated) {
$output->writeln('Done.');
}
diff --git a/core/Migrations/Version14000Date20180522074438.php b/core/Migrations/Version14000Date20180522074438.php
index 28207d0b900c8..bb0de125f6f24 100644
--- a/core/Migrations/Version14000Date20180522074438.php
+++ b/core/Migrations/Version14000Date20180522074438.php
@@ -55,6 +55,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure,
'length' => 1,
]);
$table->setPrimaryKey(['provider_id', 'uid']);
+ $table->addIndex(['uid'], 'twofactor_providers_uid');
}
return $schema;