cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot update directory_id in core_file_storage table

Cannot update directory_id in core_file_storage table

I have tried the following, which all fail:

Mage::getModel('core/file_storage_database')->loadByFilename()->setDirectoryId(100)->save();
Mage::getSingleton('core/resource')->getConnection('core_write')->update('core_file_storage', array('directory_id' => '100'), 'file_id = 100');
Mage::getSingleton('core/resource')->getConnection('core_write')->query("UPDATE core_file_storage SET directory_id = 100 WHERE file_id = 100");

I have turned on db debugging to ensure there are no hidden modules/queries resetting the directory_id after save. I only have two queries in the debug, which are the select (model->loadByFilename) and the update (model->save).

 

It seems the only way to update it is to bypass Magento altogether. When I create a db connection outside of Magento it has no problem updating:

$conn = new PDO("mysql:host={$server};dbname={$dbname}", $username, $password);
$conn->query("UPDATE core_file_storage SET directory_id = 100 WHERE file_id = 100");

Could anybody point me in the right direction?
Transaction? Lock Tables?