Skip to content
Snippets Groups Projects
Commit 726a405d authored by Jonas Rittershofer's avatar Jonas Rittershofer
Browse files

Increase description length

parent 6ebd1927
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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.
......
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Jonas Rittershofer <jotoeri@users.noreply.github.com>
*
* @author Jonas Rittershofer <jotoeri@users.noreply.github.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\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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment