From 82876c573ef9c6b85090edc69da4e59c797dffcf Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 21:59:45 +0200 Subject: [PATCH] Set a length to comment table's name column The name column was of text type. Passed to VARCHAR(64), like the poll name column. --- admin/migration.php | 2 + .../Alter_Comment_table_for_name_length.php | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php diff --git a/admin/migration.php b/admin/migration.php index 25bc733..9eceac0 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -22,6 +22,7 @@ use Framadate\Migration\From_0_8_to_0_9_Migration; use Framadate\Migration\AddColumn_receiveNewComments_For_0_9; use Framadate\Migration\AddColumn_uniqId_In_vote_For_0_9; use Framadate\Migration\AddColumn_hidden_In_poll_For_0_9; +use Framadate\Migration\Alter_Comment_table_for_name_length; use Framadate\Migration\Migration; use Framadate\Utils; @@ -36,6 +37,7 @@ $migrations = [ new AddColumn_receiveNewComments_For_0_9(), new AddColumn_uniqId_In_vote_For_0_9(), new AddColumn_hidden_In_poll_For_0_9(), + new Alter_Comment_table_for_name_length(), ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php b/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php new file mode 100644 index 0000000..99e0adb --- /dev/null +++ b/app/classes/Framadate/Migration/Alter_Comment_table_for_name_length.php @@ -0,0 +1,72 @@ +alterCommentTable($pdo); + + return true; + } + + private function alterCommentTable(\PDO $pdo) { + $pdo->exec(' + ALTER TABLE `' . Utils::table('comment') . '` + CHANGE `name` `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;'); + } + +}