MG 1.1 SQL error

TheComputerGuy

Active member
Hi there,
When trying to create a new category for within the MG the follow error occurs

Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Unknown column 'album_warning_id' in 'field list' - library/Zend/Db/Statement/Mysqli.php:77

Using 1.1.9, would upgrading to 1.1.10 correct this?
 

Chris D

XenForo developer
Staff member
I'm not really sure why you would get that if you are creating a category in the Admin CP. This is certainly not a known issue, nor one I would expect to see when creating a category.

Or do you mean when creating an album?

If you go into the Admin CP and click on this error, does it have any more details in the stack trace section?
 

TheComputerGuy

Active member
Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Unknown column 'album_warning_id' in 'field list' - library/Zend/Db/Statement/Mysqli.php:77
Generated By: Admin Help, Today at 11:26 AM
Stack Trace
#0 /vhosts/site.com/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('INSERT INTO `xe...')
#1 /vhosts/site.com/library/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'INSERT INTO `xe...')
#2 /vhosts/site.com/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('INSERT INTO `xe...')
#3 /mnt/efs/vhosts/site.com/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xe...', Array)
#4 /vhosts/site.com/library/XenForo/DataWriter.php(1638): Zend_Db_Adapter_Abstract->insert('xengallery_albu...', Array)
#5 /vhosts/site.com/library/XenForo/DataWriter.php(1627): XenForo_DataWriter->_insert()
#6 /vhosts/site.com/library/XenForo/DataWriter.php(1419): XenForo_DataWriter->_save()
#7 //vhosts/site.com/library/XenGallery/ControllerPublic/Album.php(1075): XenForo_DataWriter->save()
#8 /vhosts/site.com/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_Album->actionCreate()
#9 /vhosts/site.com/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /vhosts/site.com/index.php(13): XenForo_FrontController->run()
#11 {main}
Request State
array(3) {
  ["url"] => string(48) "http://www.site.com/media/albums/create"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(11) {
    ["album_title"] => string(4) "test"
    ["album_description"] => string(4) "test"
    ["view_media"] => string(6) "public"
    ["view_users"] => string(0) ""
    ["add_media"] => string(7) "private"
    ["add_users"] => string(0) ""
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(21) "/media/add?album=true"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
Delete...Close
 

Chris D

XenForo developer
Staff member
I can't see what would have caused this unless at some point in the past, likely quite a long time ago, one of the upgrades failed.

These two queries might not work, but if you could try and run them from something like PhpMyAdmin and let me know the results, that'd go part of the way to either explaining or fixing the issue:

Code:
ALTER TABLE xengallery_album
CHANGE COLUMN warning_id album_warning_id INT(10) NOT NULL DEFAULT 0
Code:
ALTER TABLE xengallery_album
CHANGE COLUMN warning_message album_warning_message VARCHAR(255) NOT NULL DEFAULT ''
 

TheComputerGuy

Active member
So it seems after I was able to create an album images are not able to be uploaded, at least by the error I get. Is there a possibility an upgrade missed the db creation?

Code:
Mysqli prepare error: Unknown column 'field.display_add_media' in 'where clause'
Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Unknown column 'field.display_add_media' in 'where clause' - library/Zend/Db/Statement/Mysqli.php:77
Generated By: Admin, 10 minutes ago
Stack Trace
#0 /vhosts/site.com/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('\r\n\t\t\tSELECT fie...')
#1 /vhosts/site.com/library/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), '\r\n\t\t\tSELECT fie...')
#2 /vhosts/site.com/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('\r\n\t\t\tSELECT fie...')
#3 /vhosts/site.com/library/XenForo/Model.php(219): Zend_Db_Adapter_Abstract->query('\r\n\t\t\tSELECT fie...', Array, 2)
#4 /vhosts/site.com/library/XenGallery/Model/Field.php(69): XenForo_Model->fetchAllKeyed('\r\n\t\t\tSELECT fie...', 'field_id')
#5 /vhosts/site.com/library/XenGallery/ControllerPublic/File.php(263): XenGallery_Model_Field->getGalleryFields(Array)
#6 /vhosts/site.com/library/XenGallery/ControllerPublic/File.php(209): XenGallery_ControllerPublic_File->_getUploadResponse(22605, Array, Object(XenForo_Phrase))
#7 /vhosts/site.com/library/XenForo/FrontController.php(351): XenGallery_ControllerPublic_File->actionDoUpload()
#8 /vhosts/site.com/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /vhosts/site.com/index.php(13): XenForo_FrontController->run()
#10 {main}
 
Last edited:

Chris D

XenForo developer
Staff member
I think as a precaution you should run each of these queries. These cover all of the queries that should have run in the 1.1.0 upgrade:

Code:
ALTER TABLE xengallery_media
ADD tags MEDIUMBLOB NOT NULL
Code:
ALTER TABLE xengallery_media
DROP COLUMN media_content_tag_cache
Code:
ALTER TABLE xengallery_category
ADD min_tags SMALLINT UNSIGNED NOT NULL DEFAULT '0'
Code:
ALTER TABLE xengallery_field
ADD display_add_media TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'
Code:
ALTER TABLE xengallery_field
ADD required TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'
And just to be sure, make sure you ran the second of the two queries in my previous post. You confirmed the first solved the issue but you might need this one as well if you didn't run it.
Code:
ALTER TABLE xengallery_album
CHANGE COLUMN warning_message album_warning_message VARCHAR(255) NOT NULL DEFAULT ''
Don't worry if some of the queries fail, but I hope that will at least bring the schema up to date.
 
Top