Skip to content

Commit 88fa9cb

Browse files
committed
Add parent index on filecache
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 3fb8c35 commit 88fa9cb

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
@@ -132,6 +132,10 @@ function (GenericEvent $event) use ($container) {
132132
if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {
133133
$subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix');
134134
}
135+
136+
if (!$table->hasIndex('fs_parent')) {
137+
$subject->addHintForMissingSubject($table->getName(), 'fs_parent');
138+
}
135139
}
136140

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

core/Command/Db/AddMissingIndices.php

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

187197
$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
@@ -262,6 +262,7 @@ public function changeSchema(IOutput $output, \Closure $schemaClosure, array $op
262262
$table->addIndex(['storage', 'mimepart'], 'fs_storage_mimepart');
263263
$table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size');
264264
$table->addIndex(['fileid', 'storage', 'size'], 'fs_id_storage_size');
265+
$table->addIndex(['parent'], 'fs_parent');
265266
$table->addIndex(['mtime'], 'fs_mtime');
266267
$table->addIndex(['size'], 'fs_size');
267268
if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) {

0 commit comments

Comments
 (0)