Question

I'm having trouble getting some of my modules to complete their setup scripts. Looking at the core_resource table shows that catalog_setup has a higher version than data version. This has been a problem since I took over this position and I think this error may be preventing other module upgrades from running. Every time the cache is flushed I receive several errors like:

Error in file:/www/sites/www.oursite.com/files/html/app/code/core/Enterprise/Catalog/sql/enterprise_catalog_setup/upgrade-1.13.0.9-1.13.0.10.php" - SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-catalog_product_website-product_id' for key 'UNQ_ENT_MVIEW_SUBSCRIBER_METADATA_ID_TARGET_TABLE_TARGET_COLUMN', query was: INSERT INTO `enterprise_mview_subscriber` (`metadata_id`, `target_table`, `target_column`) VALUES (?, ?, ?)

Trace:
#0 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.13.0.9', '1.13.0.11')
#2 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.13.0.9', '1.13.0.11')
#3 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/App.php(428): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /www/sites/www.oursite.com/files/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Model_App->_initModules()
#6 /www/sites/www.oursite.com/files/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /www/sites/www.oursite.com/files/html/index.php(85): Mage::run('', 'store')
#8 {main}

Can anyone please point me in the right direction for a fix for this? I can not reproduce this issue on my development site which is running the same version controlled code with a duplicate database.

Update: After re-checking all my assumptions, I was able to get this issue to appear on the development site. It turns out that the cron job responsible for creating the development database dump had been blocked. After getting a fresh copy of the database, the error was present.

Was it helpful?

Solution

The problem was occurring due to a previously failed install. The enterprise_catalog_setup script was trying to migrate data that already existed in the table, and failed on the duplicate entry, causing any remaining setup scripts to abort.

After completing a fresh install of Magento and comparing the two tables, only one row was missing. So, to fix this issue, we manually incremented the module version up to 1.13.0.10 in order to skip the failing script. Afterwards, all remaining scripts were able to install correctly and all module versions were matching.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top