Pergunta

I am attempting to upgrade a clients Magento to v1.7 (from v1.4). I have had a couple of minor blips along the way, but nothing too tragic.... until now.

My upgrade route is to copy the existing v1.4 database and install a fresh version of 1.7. Then running the standard upgrade script, the database should get upgraded to v1.7 (except of course any installed extensions which will need re installing following the upgrade). This is a route I have used before and seems far more reliable that upgrading via magento connect.

However, I have hit a brick wall. I am getting the following error report:

a:5:{i:0;s:464:"Error in file: "/route/to/magento/install/app/code/core/Mage/Cms/data/cms_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php" - SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento_1411_1702/cms_page_store`, CONSTRAINT `FK_CMS_PAGE_STORE_STORE_ID_CORE_STORE_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCAD)";i:1;s:1095:"#0 /route/to/magento/install/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')

Now this infers to me that there is a record in cms_page_store which has a store_id which cannot be found in the related table (in this case the ONLY related table is core_store). This is not the case. There was a record in core_store with no entries in cms_page_store and even though this did not break the referential integrity, I have removed it in desperation, without success.

I have also checked the records in the other immediately related tables and still cannot find the reason for the error.

Any ideas?

Foi útil?

Solução 3

Can you verify that you have an admin store in core_store that has store_id 0? I've bumped into similar issues with primary key IDs shifting and some assumptions made during upgrade scripts.

Outras dicas

When doing the update from 1.4 to 1.7 I had to empty two tables before succeeding. Before that I got all kinds of weird errors. The tables I emptied (not deleted, only emptied) are: report_compared_product_index & report_viewed_product_index Try if that helps in your case, too.

Oh, I forgot, in case you wonder. The tables are used for non-essential statistical data about compared and viewed products. If you are dependent on accurate store statistics of the past, then you might need to dig deeper into this issue.

Try it

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top