Skip to content

Commit e619823

Browse files
committed
fixup! PES-3078: fix installer
1 parent 1bd6deb commit e619823

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

packetery/libs/Module/Installer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ private function installDatabase()
181181
`price_total` decimal(20,6) NULL,
182182
`price_cod` decimal(20,6) NULL,
183183
`age_verification_required` tinyint(1) unsigned NULL,
184+
`point_place` varchar(70) NULL,
185+
`point_street` varchar(120) NULL AFTER `point_place`,
186+
`point_zip` varchar(10) NULL AFTER `point_street`,
187+
`point_city` varchar(70) NULL AFTER `point_zip`,
184188
UNIQUE(`id_order`),
185189
UNIQUE(`id_cart`)
186190
) ENGINE=InnoDB DEFAULT CHARSET=utf8;';

packetery/upgrade/upgrade-3.4.0.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Packetery\Module\Helper;
1010
use Packetery\Tools\ConfigHelper;
11+
use Packetery\Tools\DbTools;
1112

1213
if (!defined('_PS_VERSION_')) {
1314
exit;
@@ -42,15 +43,22 @@ function upgrade_module_3_4_0(Packetery $module): bool
4243
if (!$updateResult) {
4344
return false;
4445
}
45-
46-
Db::getInstance()->execute(
47-
'ALTER TABLE `' . _DB_PREFIX_ . 'packetery_order`
48-
ADD `point_place` varchar(70) NULL,
49-
ADD `point_street` varchar(120) NULL AFTER `point_place`,
50-
ADD `point_zip` varchar(10) NULL AFTER `point_street`,
51-
ADD `point_city` varchar(70) NULL AFTER `point_zip`'
52-
);
5346
}
5447

55-
return true;
48+
$sql = [
49+
'ALTER TABLE `' . _DB_PREFIX_ . 'packetery_order`
50+
ADD `point_place` varchar(70) NULL,
51+
ADD `point_street` varchar(120) NULL AFTER `point_place`,
52+
ADD `point_zip` varchar(10) NULL AFTER `point_street`,
53+
ADD `point_city` varchar(70) NULL AFTER `point_zip`'
54+
];
55+
56+
$dbTools = $module->diContainer->get(DbTools::class);
57+
$executeResult = $dbTools->executeQueries(
58+
$sql,
59+
$module->l('Exception raised during Packetery module upgrade:', 'upgrade-3.4.0'),
60+
true
61+
);
62+
63+
return $executeResult !== false;
5664
}

0 commit comments

Comments
 (0)