Magento 2 – Fix Undefined Index Error While Upgrading from 2.2.5 to 2.3.1

magento2magento2.2.3setup-upgrade

While running bin/Magento setup: upgrade command I am facing this error.

Schema creation/updates: Notice: Undefined index: core_store in
/data/websites/website_url/public_html/vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php
on line 152

For Magento upgrade, I follow below link instructions but now facing this problem.
https://digitalstartup.co.uk/t/how-to-upgrade-from-magento-2-2-8-to-2-3-1/528

Any help will be appreciated.

Best Answer

The problem is that the SchemaBuilder.php is attempting to look up a table that does not exist in the current database. You likely have an old foreign key table reference (from 1.9 perhaps) causing this failure.

You should run these 2 queries ( as example, tables and keys can be different ):

ALTER TABLE `wordpress_association` DROP FOREIGN KEY `FK_STORE_ID_WP_ASSOC`;
ALTER TABLE `wordpress_association` ADD CONSTRAINT `FK_STORE_ID_WP_ASSOC` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE;

EDIT

This issue could be cause also from other tables ( not just wordpress_association ). The root cause is a wrong REFERENCE in a FOREIGN KEY on one of your tables. Usually this is caused after a migration from Magento 1.x to Magento 2.x.

Related Topic