32 lines
739 B
PHP
32 lines
739 B
PHP
<?php
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
function upgrade_module_1_10_0($module)
|
|
{
|
|
$columnsToAdd = [
|
|
'alert_type' => 'VARCHAR(16) NOT NULL DEFAULT \'info\'',
|
|
'timeout' => 'INT(11) NOT NULL DEFAULT 0',
|
|
];
|
|
|
|
foreach ($columnsToAdd as $column => $definition) {
|
|
$existing = Db::getInstance()->executeS(
|
|
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'' . $column . '\''
|
|
);
|
|
|
|
if (!empty($existing)) {
|
|
continue;
|
|
}
|
|
|
|
if (!Db::getInstance()->execute(
|
|
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml` ADD COLUMN `' . $column . '` ' . $definition
|
|
)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|