【发布时间】:2014-02-13 22:03:53
【问题描述】:
我们正在尝试从 Magento EE 1.13 降级到 CE 1.8.1。
我们正在使用新的 CE 代码库,但尝试使用相同的数据库,我们认为这应该可以从以下主题中实现: https://magento.stackexchange.com/questions/6706/how-to-migrate-from-enterprise-edition-to-community-edition
在删除我们发现的任何企业参考后,该网站运行良好,但我们无法解决的一个错误是索引错误:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magentodb`.`catalog_category_product_index`, CONSTRAINT `FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DE)' in /mnt/hgfs/public/lib/Zend/Db/Statement/Pdo.php:228
搜索此错误的大部分结果都建议尝试在 catalog_category_product 表中查找对不存在产品的引用,考虑到外键约束失败,这是有道理的:
SELECT * FROM `catalog_category_product` WHERE
product_id not in (select entity_id from catalog_product_entity);
SELECT * FROM `catalog_category_product` WHERE
category_id not in (select entity_id from catalog_category_entity);
但是这些查询返回空集 - 似乎没有任何对实体表中不存在的 entity_ids 的引用。
关于这可能来自哪里的任何建议?
【问题讨论】: