From 9d2536e49eeaa2c71a10f5c0a2289a614da039b4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 24 Mar 2022 16:59:02 +0100 Subject: Fix files_external column length Signed-off-by: Joas Schilling --- apps/files_external/appinfo/info.xml | 2 +- .../Migration/Version1011Date20200630192246.php | 2 +- .../Migration/Version1016Date20220324154536.php | 62 ++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 apps/files_external/lib/Migration/Version1016Date20220324154536.php (limited to 'apps/files_external') diff --git a/apps/files_external/appinfo/info.xml b/apps/files_external/appinfo/info.xml index ea8e29c0166..f9b2b8341ce 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.16.0 + 1.16.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 5ec289428fb..c2a53e346f1 100644 --- a/apps/files_external/lib/Migration/Version1011Date20200630192246.php +++ b/apps/files_external/lib/Migration/Version1011Date20200630192246.php @@ -116,7 +116,7 @@ class Version1011Date20200630192246 extends SimpleMigrationStep { ]); $table->addColumn('value', Types::STRING, [ 'notnull' => false, - 'length' => 4096, + 'length' => 4000, ]); $table->setPrimaryKey(['config_id']); $table->addUniqueIndex(['mount_id', 'key'], 'config_mount_key'); diff --git a/apps/files_external/lib/Migration/Version1016Date20220324154536.php b/apps/files_external/lib/Migration/Version1016Date20220324154536.php new file mode 100644 index 00000000000..0f3b5522094 --- /dev/null +++ b/apps/files_external/lib/Migration/Version1016Date20220324154536.php @@ -0,0 +1,62 @@ + + * + * @author Joas Schilling + * + * @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; + +class Version1016Date20220324154536 extends SimpleMigrationStep { + + /** + * @param IOutput $output + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` + * @param array $options + */ + public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { + // FIXME do we need to check for 4000+ values? + } + + /** + * @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_config'); + $column = $table->getColumn('value'); + + if ($column->getLength() > 4000) { + $column->setLength(4000); + } + + return $schema; + } +} -- cgit v1.2.3