Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento - Base Table core_file_storage Doesn't exist

When I look in the error log for my Magento store it is full of these errors:

[02-Jun-2011 13:49:12] PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite_mysite.core_file_storage' doesn't exist' in /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/mysite/public_html/lib/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/mysite/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `e`.* FR...', Array)
#4 /home/mysite/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `e`.* FR...', Array)
#5 /home/mysite/public_html/lib/Zend/Db/Adapter/Abstract.php(753): Varien_Db_Adapter_Pdo_Mysql->query(Object(Varien_Db_Select), Array)
#6 /home/mysite/public_html/app/code/core/Mage/Core/Model/Mysql4/File/Storag in /home/mysite/public_html/lib/Zend/Db/Statement/Pdo.php on line 234

Anyone know how to solve this?

like image 666
a1anm Avatar asked Dec 09 '22 08:12

a1anm


1 Answers

Apparently I do not yet have the privileges to comment on Daniel's answer, therefore I'm adding this as a separate answer. User a1anm also asked the question on the Magento Forum. There, user furnitureforyoultd answered the question with two different queries.

First, if you do not yet have core_directory_storage, run:

CREATE TABLE `core_directory_storage` (
  `directory_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL DEFAULT '',
  `path` VARCHAR(255) NOT NULL DEFAULT '',
  `upload_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `parent_id` INT(10) UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`directory_id`),
  UNIQUE INDEX `IDX_DIRECTORY_PATH` (`name`, `path`),
  INDEX `parent_id` (`parent_id`),
  CONSTRAINT `FK_DIRECTORY_PARENT_ID` FOREIGN KEY (`parent_id`) REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE CASCADE ON DELETE CASCADE
) COMMENT='Directory storage' COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=DEFAULT;

Then, run:

CREATE TABLE `core_file_storage` (
  `file_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `content` LONGBLOB NOT NULL,
  `upload_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `filename` VARCHAR(255) NOT NULL DEFAULT '',
  `directory_id` INT(10) UNSIGNED NULL DEFAULT NULL,
  `directory` VARCHAR(255) NULL DEFAULT NULL,
  PRIMARY KEY (`file_id`),
  UNIQUE INDEX `IDX_FILENAME` (`filename`, `directory`),
  INDEX `directory_id` (`directory_id`),
  CONSTRAINT `FK_FILE_DIRECTORY` FOREIGN KEY (`directory_id`) REFERENCES `core_directory_storage` (`directory_id`) ON UPDATE CASCADE ON DELETE CASCADE
) COMMENT='File storage' COLLATE='utf8_general_ci' ENGINE=InnoDB ROW_FORMAT=DEFAULT;
like image 104
Norbert Avatar answered Dec 18 '22 11:12

Norbert