diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 8334915..c6da212 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -86,10 +86,10 @@ class PageController extends Controller { */ private $maxStringLengths = [ 'formTitle' => 256, - 'formDescription' => 2048, + 'formDescription' => 8192, 'questionText' => 2048, 'optionText' => 1024, - 'answerText' => 2048, + 'answerText' => 4096, ]; public function __construct(string $appName, diff --git a/lib/Migration/Version010200Date20200323141300.php b/lib/Migration/Version010200Date20200323141300.php index afb5463..1875ab1 100644 --- a/lib/Migration/Version010200Date20200323141300.php +++ b/lib/Migration/Version010200Date20200323141300.php @@ -91,7 +91,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep { ]); $table->addColumn('description', Type::STRING, [ 'notnull' => false, - 'length' => 2048, + 'length' => 8192, ]); $table->addColumn('owner_id', Type::STRING, [ 'notnull' => true, @@ -199,7 +199,7 @@ class Version010200Date20200323141300 extends SimpleMigrationStep { ]); $table->addColumn('text', Type::STRING, [ 'notnull' => true, - 'length' => 2048, + 'length' => 4096, ]); $table->setPrimaryKey(['id']); } @@ -350,9 +350,9 @@ class Version010200Date20200323141300 extends SimpleMigrationStep { $last_vote = $vote; //In case the old Answer would have been longer than current possible length, create a warning and shorten text to avoid Error on upgrade. - if (strlen($vote['vote_answer']) > 2048) { + if (strlen($vote['vote_answer']) > 4096) { $output->warning("Answer-text is too long for new Database: '" . $vote['vote_answer'] . "'"); - $vote['vote_answer'] = mb_substr($vote['vote_answer'], 0, 2048); + $vote['vote_answer'] = mb_substr($vote['vote_answer'], 0, 4096); } /* Due to the unconventional storing fo vote_option_ids, the vote_option_id needs to get mapped onto old question-id and from there to new question-id. diff --git a/lib/Migration/Version020002Date20200729205932.php b/lib/Migration/Version020002Date20200729205932.php new file mode 100644 index 0000000..c288234 --- /dev/null +++ b/lib/Migration/Version020002Date20200729205932.php @@ -0,0 +1,61 @@ + + * + * @author Jonas Rittershofer + * + * @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\Forms\Migration; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +class Version020002Date20200729205932 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) { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + if ($schema->hasTable('forms_v2_forms')) { + $schema->getTable('forms_v2_forms') + ->changeColumn('description', [ + 'length' => 8192, + ]); + } + + if ($schema->hasTable('forms_v2_answers')) { + $schema->getTable('forms_v2_answers') + ->changeColumn('text', [ + 'length' => 4096, + ]); + } + + return $schema; + } +}