我们正在尝试将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的引用。
有什么建议可能是从哪里来的吗?
发布于 2016-01-15 19:26:28
ALTER TABLE CLI DROP FOREIGN KEY FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID
DELETE FROM catalog_category_product_index WHERE product_id not in (select entity_id from catalog_product_entity);ALTER TABLE catalog_category_product_index ADD CONSTRAINT FK_CAT_CTGR_PRD_IDX_PRD_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (product_id) REFERENCES catalog_product_entity (entity_id) ON DELETE CASCADE ON UPDATE CASCADE;
发布于 2014-02-14 10:52:51
重读那个错误。小心
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)'特别是他们引用表格的那部分
`magentodb`.`catalog_category_product_index`, 当索引代码尝试在catalog_category_product_index中插入或更新列时,外键约束将失败。我会检查一下这张桌子是否也是干净的。
发布于 2014-11-22 14:24:33
包含消息的异常“”PDOException“”
'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_index catalog_category_product_index “Reindex Data”旁边的“Category Products”索引
https://stackoverflow.com/questions/21766512
复制相似问题