2

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.

| improve this question | | | | |
  • Can you write a code of exactly what you did. Trying to solve similar issue – Olga Bautina Jun 28 '19 at 0:15
3

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:

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;
| improve this answer | | | | |
0

To solve this issue I added an "if condition" to ignore the code if this [core_store] index will come.

// replace 
if($tables[$referenceTableName] != 'core_store' ){
    if (isset($tables[$referenceTableName]) && $referenceTableName !== $tableName) {
        $this->processReferenceKeys([$referenceTableName => 
        $tables[$referenceTableName]], $schema);
        unset($tables[$referenceTableName]);
    }
}
| improve this answer | | | | |
  • or you can copy paste these Empty tables in your Database (core_store, core_website) from Magento 1.9 – sourabh yadav Jul 1 '19 at 8:34
  • This is a temporary solution. The correct answer of your question is shared by @MarcoValenziano. You need to figure out the tables using wrong foreign key constrains to fix this problem. – Sumit Mar 11 at 12:51
0

I solved this issue by doing following

  1. Exported the SQL dump for the database
  2. Searched for core_store from the error Undefined index: core_store
  3. Dropped all the foreign keys referencing that table
  4. Dropped that table altogether, as it was no longer needed.

That solved my problem.

But remember to keep database backup before doing that.

| improve this answer | | | | |
0

i have the same issue. I dont like to modify the core code. So i just opened this file:

vendor/magento/framework/Setup/Declaration/Schema/Db/SchemaBuilder.php

and add some debug messages, to see where the problem is. The script stops on FK dependencies on flat tables.

So my solution was to delete them. After this bin/magento setup:upgrade runs with out error!

| improve this answer | | | | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.