Magento version 1.9.1.0 Database Issue

262 Views Asked by At

I have developed a website on Magento version 1.9.1.0 and getting an issue of the duplicate entry in database table "report_viewed_product_index". I have checked database table and found in this table no foreign key constraints define but in SQL setup they have foreign keys for this table.

After this, we have checked the database of Magento version 1.9.0.1 and they also have same SQL setup for this table and also define foreign keys under this table.

Without foreign key the table not updated automatically. so it will generate duplicate entry error for product report. and give 404 page not found an error on product detail page after login customer.

How can I solve this issue?

CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core/store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_CUSTOMER` FOREIGN KEY (`customer_id`) REFERENCES `{$installer->getTable('customer/entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_REPORT_VIEWED_PRODUCT_INDEX_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog/product')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
0

There are 0 best solutions below