function mail_logger_update_6001 in Mail Logger 6
Rename the 'to' and 'from' columns to avoid using MySQL reserved keywords.
File
- ./
mail_logger.install, line 128 - Install and update functions for Mail Logger module.
Code
function mail_logger_update_6001() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {mail_logger} CHANGE COLUMN `to` mail_to varchar (255) NOT NULL");
$ret[] = update_sql("ALTER TABLE {mail_logger} CHANGE COLUMN `from` mail_from varchar (255) NOT NULL");
break;
case 'pgsql':
db_change_column($ret, 'mail_logger', 'to', 'mail_to', 'varchar', array(
'not null' => TRUE,
));
db_change_column($ret, 'mail_logger', 'from', 'mail_from', 'varchar', array(
'not null' => TRUE,
));
break;
}
// Remake the indexes on the two changed columns.
// The backticks ` are needed to protect the MySQL reserved keywords.
db_drop_index($ret, 'mail_logger', '`to`');
db_drop_index($ret, 'mail_logger', '`from`');
db_add_index($ret, 'mail_logger', 'mail_to', array(
'mail_to',
));
db_add_index($ret, 'mail_logger', 'mail_from', array(
'mail_from',
));
return $ret;
}