Jihene Heni Posted March 12, 2018 Share Posted March 12, 2018 Hi , I want to create a table association between two tables in Module Installation Prestashop 1.7 I tried this code in module installation: public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); $sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'tab3` ( id_a INT(10) NOT NULL, id_b INT (10) NOT NULL, CONSTRAINT pk_asso PRIMARY KEY ( id_a, id_b ) ,CONSTRAINT fk_asso2 FOREIGN KEY ( id_a ) REFERENCES ps_tab1( id_tab1) ),CONSTRAINT fk_asso1 FOREIGN KEY ( id_b ) REFERENCES ps_tab2( id_tab2) , ) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;'; if(!$result=Db::getInstance()->Execute($sql)) return false; return parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header') && Configuration::updateValue('MYMODULE_NAME', 'my friend'); } it does'nt work 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