35 lines
913 B
PHP
35 lines
913 B
PHP
<?php
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
function upgrade_module_1_6_0($module)
|
|
{
|
|
$columnsToAdd = [
|
|
'description' => 'TEXT',
|
|
'extra_description' => 'TEXT',
|
|
'link' => 'VARCHAR(512) NOT NULL DEFAULT \'\'',
|
|
'template' => 'VARCHAR(32) NOT NULL DEFAULT \'image_left\'',
|
|
'image' => 'VARCHAR(255) NOT NULL DEFAULT \'\'',
|
|
];
|
|
|
|
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;
|
|
}
|