diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-24 16:59:02 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-25 12:44:51 +0100 |
commit | 9d2536e49eeaa2c71a10f5c0a2289a614da039b4 (patch) | |
tree | a019918be0745bc488bcb2895ced184f07086ac5 /apps/files_external/lib/Migration/Version1016Date20220324154536.php | |
parent | 129bae62d42d58166f51d8f7167b00b4761d60c5 (diff) | |
download | nextcloud-server-9d2536e49eeaa2c71a10f5c0a2289a614da039b4.tar.gz nextcloud-server-9d2536e49eeaa2c71a10f5c0a2289a614da039b4.zip |
Fix files_external column length
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_external/lib/Migration/Version1016Date20220324154536.php')
-rw-r--r-- | apps/files_external/lib/Migration/Version1016Date20220324154536.php | 62 |
1 files changed, 62 insertions, 0 deletions
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 @@ +<?php + +declare(strict_types=1); +/** + * @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com> + * + * @author Joas Schilling <coding@schilljs.com> + * + * @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 <http://www.gnu.org/licenses/>. + */ + +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; + } +} |