Skip to content

Commit 69a5825

Browse files
artongebackportbot-nextcloud[bot]
authored andcommitted
Add parent index on filecache
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 3b54a60 commit 69a5825

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

core/Application.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ function (GenericEvent $event) use ($container) {
128128
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
129129
$subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix');
130130
}
131+
132+
if (!$table->hasIndex('fs_parent')) {
133+
$subject->addHintForMissingSubject($table->getName(), 'fs_parent');
134+
}
131135
}
132136

133137
if ($schema->hasTable('twofactor_providers')) {

core/Command/Db/AddMissingIndices.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@ private function addCoreIndexes(OutputInterface $output, bool $dryRun): void {
186186
$updated = true;
187187
$output->writeln('<info>Filecache table updated successfully.</info>');
188188
}
189+
if (!$table->hasIndex('fs_parent')) {
190+
$output->writeln('<info>Adding additional parent index to the filecache table, this can take some time...</info>');
191+
$table->addIndex(['parent'], 'fs_parent');
192+
$sqlQueries = $this->connection->migrateToSchema($schema->getWrappedSchema(), $dryRun);
193+
if ($dryRun && $sqlQueries !== null) {
194+
$output->writeln($sqlQueries);
195+
}
196+
$updated = true;
197+
$output->writeln('<info>Filecache table updated successfully.</info>');
198+
}
189199
}
190200

191201
$output->writeln('<info>Check indices of the twofactor_providers table.</info>');

core/Migrations/Version13000Date20170718121200.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
263263
$table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart');
264264
$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
265265
$table->addIndex(['fileid', 'storage', 'size'], 'fs_id_storage_size');
266+
$table->addIndex(['parent'], 'fs_parent');
266267
$table->addIndex(['mtime'], 'fs_mtime');
267268
$table->addIndex(['size'], 'fs_size');
268269
if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {

0 commit comments

Comments
 (0)