UrlNaming - Increase size of poll's id column
This commit is contained in:
parent
c78613481e
commit
421f86d8a3
|
@ -26,6 +26,7 @@ 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\Increase_pollId_size;
|
||||
use Framadate\Migration\Migration;
|
||||
use Framadate\Migration\RPadVotes_from_0_8;
|
||||
use Framadate\Utils;
|
||||
|
@ -46,6 +47,7 @@ $migrations = [
|
|||
new Alter_Comment_table_for_name_length(),
|
||||
new Alter_Comment_table_adding_date(),
|
||||
new AddColumns_password_hash_And_results_publicly_visible_In_poll_For_0_9(),
|
||||
new Increase_pollId_size()
|
||||
];
|
||||
// ---------------------------------------
|
||||
|
||||
|
|
46
app/classes/Framadate/Migration/Increase_pollId_size.php
Normal file
46
app/classes/Framadate/Migration/Increase_pollId_size.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
namespace Framadate\Migration;
|
||||
|
||||
use Framadate\Utils;
|
||||
|
||||
class Increase_pollId_size implements Migration {
|
||||
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should describe in english what is the purpose of the migration class.
|
||||
*
|
||||
* @return string The description of the migration class
|
||||
*/
|
||||
function description() {
|
||||
return 'Increase the size of id column in poll table';
|
||||
}
|
||||
|
||||
/**
|
||||
* This method could check if the execute method should be called.
|
||||
* It is called before the execute method.
|
||||
*
|
||||
* @param \PDO $pdo The connection to database
|
||||
* @return bool true if the Migration should be executed
|
||||
*/
|
||||
function preCondition(\PDO $pdo) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This methode is called only one time in the migration page.
|
||||
*
|
||||
* @param \PDO $pdo The connection to database
|
||||
* @return bool true if the execution succeeded
|
||||
*/
|
||||
function execute(\PDO $pdo) {
|
||||
$this->alterPollTable($pdo);
|
||||
}
|
||||
|
||||
private function alterPollTable(\PDO $pdo) {
|
||||
$pdo->exec('
|
||||
ALTER TABLE `' . Utils::table('poll') . '`
|
||||
CHANGE `id` `id` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user