diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2022-01-07 08:46:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 08:46:22 +0100 |
commit | 064f2615d74cdbe10f0ff56cb45a11066767991f (patch) | |
tree | c581eafad733f6d504ae01b3e1fb02ae4588c3b3 /core | |
parent | 191d9b7f473841b063ff48f0e2c327e1adb84630 (diff) | |
parent | a61ac5acf5b55747b5383e72d993510f49fd44fe (diff) | |
download | nextcloud-server-064f2615d74cdbe10f0ff56cb45a11066767991f.tar.gz nextcloud-server-064f2615d74cdbe10f0ff56cb45a11066767991f.zip |
Merge pull request #29325 from nextcloud/backport/28541/stable21
Diffstat (limited to 'core')
-rw-r--r-- | core/Application.php | 5 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 8 | ||||
-rw-r--r-- | core/Migrations/Version13000Date20170718121200.php | 4 |
3 files changed, 17 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php index 77cd221bb83..c127d94622f 100644 --- a/core/Application.php +++ b/core/Application.php @@ -32,6 +32,7 @@ namespace OC\Core; +use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use OC\Authentication\Events\RemoteWipeFinished; use OC\Authentication\Events\RemoteWipeStarted; use OC\Authentication\Listeners\RemoteWipeActivityListener; @@ -115,6 +116,10 @@ class Application extends App { if (!$table->hasIndex('fs_size')) { $subject->addHintForMissingSubject($table->getName(), 'fs_size'); } + + if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { + $subject->addHintForMissingSubject($table->getName(), 'fs_storage_path_prefix'); + } } if ($schema->hasTable('twofactor_providers')) { diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 824c7073bd3..518b0e638cf 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -33,6 +33,7 @@ declare(strict_types=1); namespace OC\Core\Command\Db; +use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use OC\DB\Connection; use OC\DB\SchemaWrapper; use OCP\IDBConnection; @@ -144,6 +145,13 @@ class AddMissingIndices extends Command { $updated = true; $output->writeln('<info>Filecache table updated successfully.</info>'); } + if (!$table->hasIndex('fs_storage_path_prefix') && !$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { + $output->writeln('<info>Adding additional path index to the filecache table, this can take some time...</info>'); + $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]); + $this->connection->migrateToSchema($schema->getWrappedSchema()); + $updated = true; + $output->writeln('<info>Filecache table updated successfully.</info>'); + } } $output->writeln('<info>Check indices of the twofactor_providers table.</info>'); diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index b020effe5aa..393fe4f6ad6 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -30,6 +30,7 @@ namespace OC\Core\Migrations; +use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use OCP\DB\Types; use OCP\DB\ISchemaWrapper; use OCP\IDBConnection; @@ -262,6 +263,9 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { $table->addIndex(['storage', 'size', 'fileid'], 'fs_storage_size'); $table->addIndex(['mtime'], 'fs_mtime'); $table->addIndex(['size'], 'fs_size'); + if (!$schema->getDatabasePlatform() instanceof PostgreSQL94Platform) { + $table->addIndex(['storage', 'path'], 'fs_storage_path_prefix', [], ['lengths' => [null, 64]]); + } } if (!$schema->hasTable('group_user')) { |