eibrahimov Posted September 21, 2016 Share Posted September 21, 2016 Hi guys, In some times my customers wrote me that module helper tables not created in database. Because, all privileges Granted. How do you think about this? Thank for all. module install code: public function install() { // Prepare tab $tab = new Tab(); $tab->active = 1; $tab->class_name = 'AdminMigrationPro'; $tab->name = array(); foreach (Language::getLanguages(true) as $lang) { $tab->name[$lang['id_lang']] = 'MigrationPro'; } $tab->id_parent = -1; $tab->module = $this->name; include(dirname(__FILE__) . '/sql/install.php'); if (!$tab->add() || !parent::install() || !$this->registerHook('header') || !$this->registerHook('backOfficeHeader') ) { return false; } return true; } install.php $sql = array(); $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'migrationpro_data`; CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'migrationpro_data` ( `id_data` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(3) NOT NULL, `source_id` int(11) NOT NULL, `local_id` int(11) NOT NULL, PRIMARY KEY (`id_data`), UNIQUE KEY `type_source_id` (`type`,`source_id`), KEY `type` (`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'migrationpro_mapping`; CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'migrationpro_mapping` ( `id_mapping` int(255) NOT NULL AUTO_INCREMENT, `type` varchar(255) NOT NULL, `source_id` int(11) NOT NULL, `source_name` varchar(255) NOT NULL, `local_id` int(11) DEFAULT NULL, PRIMARY KEY (`id_mapping`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'migrationpro_process`; CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'migrationpro_process` ( `id_process` int(11) NOT NULL AUTO_INCREMENT, `type` varchar(100) NOT NULL, `total` int(11) NOT NULL, `imported` int(11) NOT NULL, `id_source` int(11) NOT NULL, `error` int(11) NOT NULL, `point` int(11) NOT NULL, `time_start` timestamp NOT NULL, `finish` tinyint(1) NOT NULL, PRIMARY KEY (`id_process`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'; foreach ($sql as $query) { if (Db::getInstance()->execute($query) == false) { return false; } } Link to comment Share on other sites More sharing options...
bellini13 Posted September 22, 2016 Share Posted September 22, 2016 Because, all privileges Granted. What does that mean? A few things 1) You assume the usage of InnoDB... don't. People still use MyISAM 2) Why is the id_mapping column a 255 length int? 3) What troubleshooting have you done for these customers that complain? Are you able to create these tables manually on their server when they report the issue to you? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now