diff --git a/admin/migration.php b/admin/migration.php index 5ed3c70..ad58d66 100644 --- a/admin/migration.php +++ b/admin/migration.php @@ -25,6 +25,7 @@ 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\Generate_uniqId_for_old_votes; +use Framadate\Migration\AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9; use Framadate\Migration\Migration; use Framadate\Migration\RPadVotes_from_0_8; use Framadate\Utils; @@ -43,7 +44,8 @@ $migrations = [ new Generate_uniqId_for_old_votes(), new RPadVotes_from_0_8(), new Alter_Comment_table_for_name_length(), - new Alter_Comment_table_adding_date() + new Alter_Comment_table_adding_date(), + new AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9(), ]; // --------------------------------------- diff --git a/app/classes/Framadate/Migration/AddColumn_hidden_In_poll_For_0_9.php b/app/classes/Framadate/Migration/AddColumn_hidden_In_poll_For_0_9.php index dd335f9..f03356f 100644 --- a/app/classes/Framadate/Migration/AddColumn_hidden_In_poll_For_0_9.php +++ b/app/classes/Framadate/Migration/AddColumn_hidden_In_poll_For_0_9.php @@ -57,7 +57,7 @@ class AddColumn_hidden_In_poll_For_0_9 implements Migration { } /** - * This methode is called only one time in the migration page. + * This method is called only one time in the migration page. * * @param \PDO $pdo The connection to database * @return bool true is the execution succeeded diff --git a/app/classes/Framadate/Migration/AddColumn_receiveNewComments_For_0_9.php b/app/classes/Framadate/Migration/AddColumn_receiveNewComments_For_0_9.php index 865502a..850fc63 100644 --- a/app/classes/Framadate/Migration/AddColumn_receiveNewComments_For_0_9.php +++ b/app/classes/Framadate/Migration/AddColumn_receiveNewComments_For_0_9.php @@ -57,7 +57,7 @@ class AddColumn_receiveNewComments_For_0_9 implements Migration { } /** - * This methode is called only one time in the migration page. + * This method is called only one time in the migration page. * * @param \PDO $pdo The connection to database * @return bool true is the execution succeeded diff --git a/app/classes/Framadate/Migration/AddColumn_uniqId_In_vote_For_0_9.php b/app/classes/Framadate/Migration/AddColumn_uniqId_In_vote_For_0_9.php index 440d2de..0b91985 100644 --- a/app/classes/Framadate/Migration/AddColumn_uniqId_In_vote_For_0_9.php +++ b/app/classes/Framadate/Migration/AddColumn_uniqId_In_vote_For_0_9.php @@ -57,7 +57,7 @@ class AddColumn_uniqId_In_vote_For_0_9 implements Migration { } /** - * This methode is called only one time in the migration page. + * This method is called only one time in the migration page. * * @param \PDO $pdo The connection to database * @return bool true is the execution succeeded diff --git a/app/classes/Framadate/Migration/AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9.php b/app/classes/Framadate/Migration/AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9.php new file mode 100644 index 0000000..9e6e5ca --- /dev/null +++ b/app/classes/Framadate/Migration/AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9.php @@ -0,0 +1,78 @@ +query('SHOW TABLES'); + $tables = $stmt->fetchAll(\PDO::FETCH_COLUMN); + + // Check if tables of v0.9 are presents + $diff = array_diff([Utils::table('poll'), Utils::table('slot'), Utils::table('vote'), Utils::table('comment')], $tables); + return count($diff) === 0; + } + + /** + * This method is called only one time in the migration page. + * + * @param \PDO $pdo The connection to database + * @return bool true is the execution succeeded + */ + function execute(\PDO $pdo) { + $this->alterPollTable($pdo); + + return true; + } + + private function alterPollTable(\PDO $pdo) { + $pdo->exec(' + ALTER TABLE `' . Utils::table('poll') . '` + ADD `password_hash` VARCHAR(255) NULL DEFAULT NULL , + ADD `results_publicly_visible` TINYINT(1) NULL DEFAULT NULL'); + } + +} diff --git a/app/classes/Framadate/Migration/From_0_0_to_0_8_Migration.php b/app/classes/Framadate/Migration/From_0_0_to_0_8_Migration.php index ac985f5..01ea838 100644 --- a/app/classes/Framadate/Migration/From_0_0_to_0_8_Migration.php +++ b/app/classes/Framadate/Migration/From_0_0_to_0_8_Migration.php @@ -57,7 +57,7 @@ class From_0_0_to_0_8_Migration implements Migration { } /** - * This methode is called only one time in the migration page. + * This method is called only one time in the migration page. * * @param \PDO $pdo The connection to database * @return bool true is the execution succeeded diff --git a/app/classes/Framadate/Migration/From_0_8_to_0_9_Migration.php b/app/classes/Framadate/Migration/From_0_8_to_0_9_Migration.php index 4598449..fa7f40c 100644 --- a/app/classes/Framadate/Migration/From_0_8_to_0_9_Migration.php +++ b/app/classes/Framadate/Migration/From_0_8_to_0_9_Migration.php @@ -57,7 +57,7 @@ class From_0_8_to_0_9_Migration implements Migration { } /** - * This methode is called only one time in the migration page. + * This method is called only one time in the migration page. * * @param \PDO $pdo The connection to database * @return bool true is the execution succeeded