Skip to content

Commit 354d754

Browse files
[*] MO : Adding creating - deleting ganalytics_data table
1 parent b5f9bef commit 354d754

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

ps_googleanalytics.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function uninstall()
9191
*/
9292
protected function createTables()
9393
{
94-
return (bool)Db::getInstance()->execute('
94+
if ((bool)Db::getInstance()->execute('
9595
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ganalytics` (
9696
`id_google_analytics` int(11) NOT NULL AUTO_INCREMENT,
9797
`id_order` int(11) NOT NULL,
@@ -103,17 +103,35 @@ protected function createTables()
103103
KEY `id_order` (`id_order`),
104104
KEY `sent` (`sent`)
105105
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8 AUTO_INCREMENT=1
106-
');
106+
') && (bool)Db::getInstance()->execute('
107+
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'ganalytics_data` (
108+
`id_cart` int(11) NOT NULL,
109+
`id_shop` int(11) NOT NULL,
110+
`data` TEXT DEFAULT NULL,
111+
PRIMARY KEY (`id_cart`)
112+
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8
113+
'))
114+
{
115+
return true;
116+
}
117+
118+
return false;
107119
}
108120

109121
/**
110122
* deletes tables
111123
*/
112124
protected function deleteTables()
113125
{
114-
return (bool)Db::getInstance()->execute('
126+
if ((bool)Db::getInstance()->execute('
115127
DROP TABLE IF EXISTS `'._DB_PREFIX_.'ganalytics`
116-
');
128+
') && (bool)Db::getInstance()->execute('
129+
DROP TABLE IF EXISTS `'._DB_PREFIX_.'ganalytics_data`
130+
')) {
131+
return true;
132+
}
133+
134+
return false;
117135
}
118136

119137
public function displayForm()

0 commit comments

Comments
 (0)