Error table prefix
Closed this issue · 1 comments
Error description:
Error getting the prefix of the database after updating to version 103.4.59
Exception #0 (Magento\Framework\DB\Adapter\TableNotFoundException): SQLSTATE[42S02]: Base table or view not found: 1146 Table mstecommerce.core_config_data doesnt exist, query was: SELECT main_table.mailchimp_store_id FROM mstmailchimp_sync_ecommerce AS main_table LEFT JOIN core_config_data AS core_config ON value = mailchimp_store_id WHERE (value is null) GROUP BY mailchimp_store_id 1 Magento\Framework\DB\Adapter\Pdo\Mysql->query() called at [generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:95] #2 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->query() called at [vendor/magento/zend-db/library/Zend/Db/Adapter/Abstract.php:737] #3 Zend_Db_Adapter_Abstract->fetchAll() called at [generated/code/Magento/Framework/DB/Adapter/Pdo/Mysql/Interceptor.php:1085] #4 Magento\Framework\DB\Adapter\Pdo\Mysql\Interceptor->fetchAll() called at [vendor/magento/framework/Data/Collection/Db/FetchStrategy/Query.php:21] #5 Magento\Framework\Data\Collection\Db\FetchStrategy\Query->fetchAll() called at [vendor/magento/framework/Data/Collection/AbstractDb.php:782] #6 Magento\Framework\Data\Collection\AbstractDb->_fetchAll() called at [vendor/magento/framework/Data/Collection/AbstractDb.php:677] #7 Magento\Framework\Data\Collection\AbstractDb->getData() called at [vendor/magento/framework/Interception/Interceptor.php:58] #8 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #9 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #10 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->___callPlugins() called at [generated/code/Ebizmarts/MailChimp/Model/ResourceModel/MailChimpSyncEcommerce/Collection/Interceptor.php:320] #11 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->getData() called at [vendor/magento/framework/Data/Collection/AbstractDb.php:580] #12 Magento\Framework\Data\Collection\AbstractDb->loadWithFilter() called at [generated/code/Ebizmarts/MailChimp/Model/ResourceModel/MailChimpSyncEcommerce/Collection/Interceptor.php:302] #13 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->loadWithFilter() called at [vendor/magento/framework/Data/Collection/AbstractDb.php:565] #14 Magento\Framework\Data\Collection\AbstractDb->load() called at [generated/code/Ebizmarts/MailChimp/Model/ResourceModel/MailChimpSyncEcommerce/Collection/Interceptor.php:293] #15 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->load() called at [vendor/magento/framework/Data/Collection.php:852] #16 Magento\Framework\Data\Collection->count() called at [generated/code/Ebizmarts/MailChimp/Model/ResourceModel/MailChimpSyncEcommerce/Collection/Interceptor.php:644] #17 Ebizmarts\MailChimp\Model\ResourceModel\MailChimpSyncEcommerce\Collection\Interceptor->count() called at [vendor/mailchimp/mc-magento2/Controller/Adminhtml/Ecommerce/CheckEcommerce.php:77]
Steps to reproduce:
Storeadmin->mailchimp->configuration
Possible solution:
diff --git a/vendor/mailchimp/mc-magento2/Helper/Data.php b/vendor/mailchimp/mc-magento2/Helper/Data.php index 6283059b16..98b4baff28 100644 --- a/vendor/mailchimp/mc-magento2/Helper/Data.php +++ b/vendor/mailchimp/mc-magento2/Helper/Data.php @@ -1023,6 +1023,10 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper public function getTableName($tableName, $conn = ResourceConnection::DEFAULT_CONNECTION) { $connection = $this->_resource->getConnection($conn); + $tablePrefix = $this->_resource->getTablePrefix(); + if ($tablePrefix && strpos($tableName, $tablePrefix) !== 0) { + $tableName = $tablePrefix . $tableName; + } return $connection->getTableName($tableName, $conn); } public function getWebsiteId($storeId)
Just upgraded to 103.4.59 also.
When we navigate to Mailchimp > Configuration in Magento dashboard we see the error:
"A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later."
system.log reads:
[2024-03-15T14:48:54.648308+00:00] main.ERROR: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.core_config_data' doesn't exist, query was: SELECT main_table
.mailchimp_store_id
FROM databasename_mailchimp_sync_ecommerce
AS main_table
LEFT JOIN core_config_data
AS core_config
ON value = mailchimp_store_id WHERE (value is null) GROUP BY mailchimp_store_id
[] []
We also have a database prefix and it's not included in the SQL statement.
cron.log also populating with errors such as:
Table 'databasename.mailchimp_sync_ecommerce' doesn't exist in
Noticeably missing the table prefix.
@mohammedTBB solution above doesn't seem to work for us.
We have reverted back to 103.4.57.