1

My upgrade won't conclude. Can you help me "translating" to a simpler sentence this error message?

Error message

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (DATABASE-incremental.salesrule_coupon_usage, CONSTRAINT FK_SALESRULE_COUPON_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY FOREIGN KEY (customer_id) REFERENCES customer_entity (entity_id) O)";i:1;s:1228:"#0 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception('Mage_Core', 'Error in file: ...')

So far I understand that a child table ("salesrule_coupon_usage") has a constraint ("FK_SALESRULE_COUPON_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY") that makes Magento compare to the parent table ("customer_entity") where there are some values ("entity_id") that aren't on the child table ("customer_id").

I'm ok removing values and I'd like to know if I have to remove them from the parent table.

Complete error

a:5:{i:0;s:477:"Error in file: "/is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/SalesRule/sql/salesrule_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php" - SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`DATABASE-incremental`.`salesrule_coupon_usage`, CONSTRAINT `FK_SALESRULE_COUPON_CUSTOMER_CUSTOMER_ID_CUSTOMER_ENTITY` FOREIGN KEY (`customer_id`) REFERENCES `customer_entity` (`entity_id`) O)";i:1;s:1228:"#0 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/Resource/Setup.php(390): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/Resource/Setup.php(289): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.7.12', '1.4.0.0.6')
#2 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/Resource/Setup.php(233): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.7.12', '1.4.0.0.6')
#3 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/Resource/Setup.php(161): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/App.php(363): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /is/htdocs/wpSERVER/www/clonsite-incremental/app/code/core/Mage/Core/Model/App.php(295): Mage_Core_Model_App->_initModules()
#6 /is/htdocs/wpSERVER/www/clonsite-incremental/app/Mage.php(596): Mage_Core_Model_App->run(Array)
#7 /is/htdocs/wpSERVER/www/clonsite-incremental/index.php(80): Mage::run('', 'store')
#8 {main}";s:3:"url";s:27:"/clonsite-incremental/admin";s:11:"script_name";s:31:"/clonsite-incremental/index.php";s:4:"skin";s:7:"default";}

Thank you!

0

I finally restored the database and files, went to the admin area and removed the sales rules and the clients (they were faulty in some database tables that I messed up prior to that). I previously exported to CSV the clients which are important, but removed the sales rules as they can easily be reproduced later on. Then I cleared the cache, logged out, overwrote files with the newer version, and went to the admin. It worked, and the upgrade completed.

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.