I have taken over a Magento 2 website and I have noticed quiet a few tables with no foreign keys e.g. a table is missing CONSTRAING 'CATALOG_PRODUCT_ENTITY_VARCHAR_STORE_ID_STORE_ID' FOREIGN KEY ('store_id') REFERENCES 'store' ('store_id') ON DELETE CASCADE.

I haven't come across this issue before and I am not sure if simply adding the missing foreign keys back would fix all of the issues (assuming I could find all of the missing keys). I know there is a database repair tool for Magento 1.9 and I've seen one or two suggestions to run from the CLI the database scheme update. The keys have been missing for the last few months and quiet a few records would have been added/deleted since then.

I am a bit unsure how to start fixing this issue. Create blank magento site and import the current database data to it, or add the missing keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.