Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table 'dbName.core_file_storage' doesn't exist #2614

Closed
alexh-swdev opened this issue Sep 21, 2022 · 8 comments · Fixed by #2627
Closed

Table 'dbName.core_file_storage' doesn't exist #2614

alexh-swdev opened this issue Sep 21, 2022 · 8 comments · Fixed by #2627

Comments

@alexh-swdev
Copy link
Contributor

alexh-swdev commented Sep 21, 2022

I am on OpenMage 20.0.16 and PHP8.0

In the Exception.log, I see the following entries:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbName.core_file_storage' doesn't exist in /var/www/vhosts/....../lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /var/www/vhosts/....../lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute()
#1 /var/www/vhosts/....../lib/Varien/Db/Statement/Pdo/Mysql.php(103): Zend_Db_Statement_Pdo->_execute()
#2 /var/www/vhosts/....../app/code/core/Zend/Db/Statement.php(290): Varien_Db_Statement_Pdo_Mysql->_execute()
#3 /var/www/vhosts/....../lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute()
#4 /var/www/vhosts/....../lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query()
#5 /var/www/vhosts/....../lib/Varien/Db/Adapter/Pdo/Mysql.php(501): Zend_Db_Adapter_Pdo_Abstract->query()
#6 /var/www/vhosts/....../lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query()
#7 /var/www/vhosts/....../app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php(144): Zend_Db_Adapter_Abstract->fetchRow()
#8 /var/www/vhosts/....../app/code/core/Mage/Core/Model/File/Storage/Database.php(118): Mage_Core_Model_Resource_File_Storage_Database->loadByFilename()
#9 /var/www/vhosts/....../get.php(148): Mage_Core_Model_File_Storage_Database->loadByFilename()
#10 {main}

Next Zend_Db_Statement_Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbName.core_file_storage' doesn't exist, query was: SELECT e.* FROM core_file_storage AS e WHERE (filename = 'filaname.jpg') AND (directory = 'catalog/product/cache/3/thumbnail/77x100/9df78eab33525d08d6e5fb8d27136e95/m/i') in /var/www/vhosts/....../lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /var/www/vhosts/....../lib/Varien/Db/Statement/Pdo/Mysql.php(103): Zend_Db_Statement_Pdo->_execute()
#1 /var/www/vhosts/....../app/code/core/Zend/Db/Statement.php(290): Varien_Db_Statement_Pdo_Mysql->_execute()
#2 /var/www/vhosts/....../lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute()
#3 /var/www/vhosts/....../lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query()
#4 /var/www/vhosts/....../lib/Varien/Db/Adapter/Pdo/Mysql.php(501): Zend_Db_Adapter_Pdo_Abstract->query()
#5 /var/www/vhosts/....../lib/Zend/Db/Adapter/Abstract.php(756): Varien_Db_Adapter_Pdo_Mysql->query()
#6 /var/www/vhosts/....../app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php(144): Zend_Db_Adapter_Abstract->fetchRow()
#7 /var/www/vhosts/....../app/code/core/Mage/Core/Model/File/Storage/Database.php(118): Mage_Core_Model_Resource_File_Storage_Database->loadByFilename()
#8 /var/www/vhosts/....../get.php(148): Mage_Core_Model_File_Storage_Database->loadByFilename()
#9 {main}

The requested images to not exist (as far as I checked - probably someone should do a cleanup there) - The table does not exist.

I don't really get, what the corresponding code really does? ( Starting here:

$localStorage = Mage::getModel('core/file_storage_file');
)
Can I savely ignore these Exceptions? Is something really broken? Is this code a left-over from some cleanup?

/Edit: Media is saved on the file system, not in the database.
/Edit 2: So, the same file on a 20.0.14 installation ignores this exception per comment and also does not have this table.
-> So... These questions remain:

  • Can I ignore this error? -> Probably, because an older version of OM does so, too
  • What should this code archive? -> ???
  • Should this table normally exist? -> ???
@ADDISON74
Copy link
Contributor

ADDISON74 commented Sep 21, 2022

You can search for the error with Google because there are many references over the years. In a post on Stackexchange, someone recommended creating that table in the database, if it doesn't exist.

You can also go to the Backend > System > Configuration and check if there is anything stored in the database. If not just press the [Save] configuration button. I faced this problem when I switched from PHP 7.0 to 8.1 and upgrading Magento old versions to OpenMage. If I remember correctly this is how I solved it.

@sreichel
Copy link
Contributor

Nice catch.

This table does no exist in "sample date" too, but is created when you change media storage to DB. So if you migrate a shop where config is set to use DB, but the table does not exist, you may run into this error.

Quick fix: got to admin section, set media storage to DB and hit "Synchronize".

@sreichel sreichel added the bug label Sep 22, 2022
@fballiano
Copy link
Contributor

should we do something about this or not?

@ADDISON74
Copy link
Contributor

We can do more but we have to simulate the issue to understand how it happens. I fixed it then but honestly speaking I didn't make it public, nor could I replicate it afterwards. Either we will have to change something in the code or mention a solution in the README file. I personally don't like the idea of creating that table in the database just to make the error disappear, I've never used the facility to store media files in the database.

@fballiano
Copy link
Contributor

@daboss84 what's your configuration for:

Schermata 2022-09-29 alle 18 22 54

It seems to make storage is configured on database but without clicking the "syncronize" the table is not created.

@ADDISON74
Copy link
Contributor

ADDISON74 commented Sep 29, 2022

I received that error message without having the modification in the Backend as in your image. I solved it by changing the "Media Storage" value with saving then going back to the initial value also with saving. I didn't want to create the table.

@alexh-swdev
Copy link
Contributor Author

alexh-swdev commented Sep 29, 2022

@fballiano I never had DB as media storage (nor do I really want to have it)
grafik

Isn't it possible to query this setting before executing this code block (or using core/file_storage_database )?
(Sadly, I did not have time to further investigate this code block - had and have some other issues since the last upgrade (but nothing for this issue tracker for now))

For the time beeing I just commented out the exception printing like it was before - but it feels wrong to handle it this way.

/Edit: "Dummy-synchronizing" is, in my eyes, a bad idea, too.

@elidrissidev
Copy link
Member

#2627 should fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants