From 2ea3cb7c93efdfde1e161c162063213097f7614f Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 16 Feb 2021 09:11:10 +0100 Subject: Drop redundant indes Those indexes are already covered by others. So those can just be used. THose extra indexes just take up space. Signed-off-by: Roeland Jago Douma --- apps/files_external/appinfo/info.xml | 2 +- .../Migration/Version1011Date20200630192246.php | 3 - .../Migration/Version22000Date20210216084416.php | 65 ++++++++++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 apps/files_external/lib/Migration/Version22000Date20210216084416.php (limited to 'apps/files_external') diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index 7fb939c75f0..0a487aa884f 100644 --- a/apps/files_external/appinfo/info.xml +++ b/apps/files_external/appinfo/info.xml @@ -9,7 +9,7 @@ This application enables administrators to configure connections to external sto External storage can be configured using the GUI or at the command line. This second option provides the advanced user with more flexibility for configuring bulk external storage mounts and setting mount priorities. More information is available in the external storage GUI documentation and the external storage Configuration File documentation. - 1.12.0 + 1.12.1 agpl Robin Appelman Michael Gapczynski diff --git a/apps/files_external/lib/Migration/Version1011Date20200630192246.php b/apps/files_external/lib/Migration/Version1011Date20200630192246.php index 73e681ce2d1..f1f9ac4b6a5 100644 --- a/apps/files_external/lib/Migration/Version1011Date20200630192246.php +++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php @@ -96,7 +96,6 @@ class Version1011Date20200630192246 extends SimpleMigrationStep { ]); $table->setPrimaryKey(['applicable_id']); $table->addIndex(['mount_id'], 'applicable_mount'); - $table->addIndex(['type', 'value'], 'applicable_type_value'); $table->addUniqueIndex(['type', 'value', 'mount_id'], 'applicable_type_value_mount'); } @@ -120,7 +119,6 @@ class Version1011Date20200630192246 extends SimpleMigrationStep { 'length' => 4096, ]); $table->setPrimaryKey(['config_id']); - $table->addIndex(['mount_id'], 'config_mount'); $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); } else { $table = $schema->getTable('external_config'); @@ -150,7 +148,6 @@ class Version1011Date20200630192246 extends SimpleMigrationStep { 'length' => 256, ]); $table->setPrimaryKey(['option_id']); - $table->addIndex(['mount_id'], 'option_mount'); $table->addUniqueIndex(['mount_id', 'key'], 'option_mount_key'); } return $schema; diff --git a/apps/files_external/lib/Migration/Version22000Date20210216084416.php b/apps/files_external/lib/Migration/Version22000Date20210216084416.php new file mode 100644 index 00000000000..babfb42748e --- /dev/null +++ b/apps/files_external/lib/Migration/Version22000Date20210216084416.php @@ -0,0 +1,65 @@ + + * + * @author Roeland Jago Douma + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Files_External\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * Auto-generated migration step: Please modify to your needs! + */ +class Version22000Date20210216084416 extends SimpleMigrationStep { + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + * @return null|ISchemaWrapper + */ + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('external_applicable'); + if ($table->hasIndex('applicable_type_value')) { + $table->dropIndex('applicable_type_value'); + } + + $table = $schema->getTable('external_config'); + if ($table->hasIndex('config_mount')) { + $table->dropIndex('config_mount'); + } + + $table = $schema->getTable('external_options'); + if ($table->hasIndex('option_mount')) { + $table->dropIndex('option_mount'); + } + + return $schema; + } +} -- cgit v1.2.3