From ba9a444f33ac11c92797cc12e73a927d6dd93c77 Mon Sep 17 00:00:00 2001 From: Antonin Date: Mon, 12 Oct 2015 22:26:22 +0200 Subject: [PATCH] Adding a date column in the comment table --- admin/migration.php | 2 + .../Alter_Comment_table_adding_date.php | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php diff --git a/admin/migration.php b/admin/migration.php index 9eceac0..978e690 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -23,6 +23,7 @@ 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\Alter_Comment_table_adding_date; use Framadate\Migration\Migration; use Framadate\Utils; @@ -38,6 +39,7 @@ $migrations = [ new AddColumn_uniqId_In_vote_For_0_9(), new AddColumn_hidden_In_poll_For_0_9(), new Alter_Comment_table_for_name_length(), + new Alter_Comment_table_adding_date(), ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php b/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php new file mode 100644 index 0000000..fd3d34e --- /dev/null +++ b/app/classes/Framadate/Migration/Alter_Comment_table_adding_date.php @@ -0,0 +1,72 @@ +alterCommentTable($pdo); + + return true; + } + + private function alterCommentTable(\PDO $pdo) { + $pdo->exec(' + ALTER TABLE `' . Utils::table('comment') . '` + ADD `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ;'); + } + +}