Fixed Unknown column 'xf_mg_media_item.album_state'

Mike S

Member
Affected version
XMG 2.3.0 Beta 5
I get this error after updating the gallery.

  • XF\Db\Exception: MySQL statement prepare error [1054]: Unknown column 'xf_mg_media_item.album_state' in 'where clause'
  • src/XF/Db/AbstractStatement.php:230
SELECT xf_mg_media_item., xf_mg_album_Album_1., xf_mg_category_Category_2., xf_user_User_3., xf_attachment_Attachment_4., xf_attachment_data_Data_5., xf_deletion_log_DeletionLog_6.*
FROM xf_mg_media_item
LEFT JOIN xf_mg_album AS xf_mg_album_Album_1 ON (xf_mg_album_Album_1.album_id = xf_mg_media_item.album_id)
LEFT JOIN xf_mg_category AS xf_mg_category_Category_2 ON (xf_mg_category_Category_2.category_id = xf_mg_media_item.category_id)
LEFT JOIN xf_user AS xf_user_User_3 ON (xf_user_User_3.user_id = xf_mg_media_item.user_id)
LEFT JOIN xf_attachment AS xf_attachment_Attachment_4 ON (xf_attachment_Attachment_4.content_type = 'xfmg_media' AND xf_attachment_Attachment_4.content_id = xf_mg_media_item.media_id)
LEFT JOIN xf_attachment_data AS xf_attachment_data_Data_5 ON (xf_attachment_data_Data_5.data_id = xf_attachment_Attachment_4.data_id)
LEFT JOIN xf_deletion_log AS xf_deletion_log_DeletionLog_6 ON (xf_deletion_log_DeletionLog_6.content_type = 'xfmg_media' AND xf_deletion_log_DeletionLog_6.content_id = xf_mg_media_item.media_id)
LEFT JOIN xf_mg_media_user_view AS xf_mg_media_user_view_Viewed_7 ON (xf_mg_media_user_view_Viewed_7.media_id = xf_mg_media_item.media_id AND xf_mg_media_user_view_Viewed_7.user_id = '2')
WHERE ((xf_mg_media_item.album_state = 'visible') OR (xf_mg_media_item.album_state IS NULL)) AND ((xf_mg_media_item.category_id IN (1, 2, 3)) OR (xf_mg_media_item.category_id = 0)) AND ((xf_mg_media_item.media_state IN ('visible', 'deleted', 'moderated'))) AND (xf_mg_media_item.media_date > 1712944524) AND (xf_mg_media_item.media_date > COALESCE(xf_mg_media_user_view_Viewed_7.media_view_date, 0))
ORDER BY xf_mg_media_item.media_date DESC, xf_mg_media_item.media_id DESC
------------

#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 1054, '42S22')
#1 src/XF/Db/Mysqli/Statement.php(40): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1054, '42S22')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Mvc/Entity/Finder.php(1443): XF\Db\AbstractAdapter->query('SELECT `xf_mg_m...')
#5 src/XF/Mvc/Entity/Finder.php(1462): XF\Mvc\Entity\Finder->fetch(NULL, NULL)
#6 src/addons/XFMG/Listener.php(150): XF\Mvc\Entity\Finder->fetchDeferred()
#7 src/XF/Extension.php(81): XFMG\Listener::appPubStartEnd(Object(XF\Pub\App))
#8 src/XF/App.php(3134): XF\Extension->fire('app_pub_start_e...', Array, NULL)
#9 src/XF/Pub/App.php(224): XF\App->fire('app_pub_start_e...', Array)
#10 src/XF/App.php(2588): XF\Pub\App->start(true)
#11 src/XF.php(532): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
Yes, this solves it.

 
Back
Top Bottom