I am running into an issue when trying to run setup:upgrade, to where it fails with saying;
SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'REVIEW_STATUS_ID_REVIEW_STATUS_STATUS_ID'; check that column/key exists, query was: ALTER TABLE review DROP FOREIGN KEY REVIEW_STATUS_ID_REVIEW_STATUS_STATUS_ID
I don't have any reviews, so my review table is empty (and never been touched), and as far as I know, default with what it has inside it;
I am not even exactly sure what could've changed in the system to even have it looking/trying to mess with that section (in trying to drop its foreign key all of a sudden).
Any ideas what could be the issue here?
Or is there a simple way to fix it -- by creating a makeshift foreign key just to appease its request perhaps?
Hello @marketing18dfb
The error indicates that Magento is trying to drop a foreign key REVIEW_STATUS_ID_REVIEW_STATUS_STATUS_ID from the review table during the setup:upgrade process, but the key does not exist in the database.
You can manually check if the foreign key exists in the database.
If the foreign key exists, the issue might be due to incorrect SQL syntax or corrupted metadata.
Manually drop the foreign key from the review table:
ALTER TABLE review DROP FOREIGN KEY REVIEW_STATUS_ID_REVIEW_STATUS_STATUS_ID; php bin/magento setup:upgrade
Hope it helps !
If you find our reply helpful, please give us kudos.
A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.
WebDesk Solution Support Team
Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Thank You,
WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789
Location: 150 King St. W. Toronto, ON M5H 1J9
Hello @johnwebdes40a5!
I will try that, my only thought though (as I don't work very much in the SQL side of things), is would the foreign key be listed as one of the columns in that table? Currently the only columns in that table are;
review_id / created_at / entity_id / entity_pk_value / status_id
Would the `REVIEW_STATUS_ID_REVIEW_STATUS_STATUS_ID` key be visible in there? Or thats not how it works?