0

My custom module (which override product controller) successfully run in my set up but when i moved it into in any set up . it will give an error like this.

Exception printing is disabled by default for security reasons.

a:5:{i:0;s:745:"Error in file: "/var/www/html/mage2016/app/code/core/Mage/Admin/sql/admin_setup/upgrade-1.6.1.1-1.6.1.2.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permission_variable' already exists, query was: CREATE TABLE permission_variable ( variable_id int UNSIGNED NOT NULL auto_increment COMMENT 'Variable ID' , variable_name varchar(255) NOT NULL default '' COMMENT 'Config Path' , is_allowed bool NOT NULL default '0' COMMENT 'Mark that config can be processed by filters' , PRIMARY KEY (variable_id, variable_name), UNIQUE UNQ_PERMISSION_VARIABLE_VARIABLE_NAME (variable_name) ) COMMENT='System variables that can be processed via content filter' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci";i:1;s:954:"#0 /var/www/html/mage2016/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')

0

This means you ran the code already and the table was created on first run, however for some reason module wasn't installed completely.

And, now when you trying to run it again, magento trying to install the table again but it finds the table already and is unable to create new one.

Solution

Although I don't know what's your sql part (or any other part).

When you first run, it must have given you an error message or a report, from where you could fix the trouble.

But now, system wont run your sql again.

I would suggest to delete the table from database directly.

Run this query in database

DROP TABLE `permission_variable`

Because you are upgrading the module, which is why you also need to edit one more thing in database:

Go to 'core_resource' table and find your module_setup(is same as in your config.xml) and edit the version and data_version to older version, i.e. 1.6.1..

**Before doing all of these, please backup your database.

Then clear the cache or reload the url.

I doubt it will throw another error message, why it cannot complete installing module. You should check this error message for further investigation.

Hope this helps.

0

In your installer I recommend to add the following lines

$installer->run("
DROP TABLE IF EXISTS {$this->getTable('permission_variable')};
");

that will drop existing table first, if module is not installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.