XF 1.2 Unknown column 'user.is_staff' in 'where clause'

Sheldon

Well-known member
Upgraded a very slow site, more of a test/play area.

Go to AdminCP, attempt to check box on a user to "Show as Staff", get this error:

Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Unknown column 'is_staff' in 'field list' - library/Zend/Db/Statement/Mysqli.php:77
Generated By: Sheldon, 1 minute ago
Stack Trace
#0 /home2/familygu/public_html/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('UPDATE `xf_user...')
#1 /home2/familygu/public_html/library/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'UPDATE `xf_user...')
#2 /home2/familygu/public_html/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('UPDATE `xf_user...')
#3 /home2/familygu/public_html/library/Zend/Db/Adapter/Abstract.php(632): Zend_Db_Adapter_Abstract->query('UPDATE `xf_user...', Array)
#4 /home2/familygu/public_html/library/XenForo/DataWriter.php(1623): Zend_Db_Adapter_Abstract->update('xf_user', Array, 'user_id = 1')
#5 /home2/familygu/public_html/library/XenForo/DataWriter.php(1592): XenForo_DataWriter->_update()
#6 /home2/familygu/public_html/library/XenForo/DataWriter.php(1388): XenForo_DataWriter->_save()
#7 /home2/familygu/public_html/library/XenForo/ControllerAdmin/User.php(510): XenForo_DataWriter->save()
#8 /home2/familygu/public_html/library/XenForo/FrontController.php(335): XenForo_ControllerAdmin_User->actionSave()
#9 /home2/familygu/public_html/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /home2/familygu/public_html/admin.php(13): XenForo_FrontController->run()
#11 {main}

Banners won't appear for Staff at all.

When checking Member List, receive this error:
Code:
Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: Unknown column 'user.is_staff' in 'where clause' - library/Zend/Db/Statement/Mysqli.php:77
Generated By: Sheldon, 3 minutes ago
Stack Trace
#0 /home2/familygu/public_html/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('?????SELECT use...')
#1 /home2/familygu/public_html/library/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), '?????SELECT use...')
#2 /home2/familygu/public_html/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('?????SELECT use...')
#3 /home2/familygu/public_html/library/XenForo/Model.php(219): Zend_Db_Adapter_Abstract->query('?????SELECT use...', Array, 2)
#4 /home2/familygu/public_html/library/XenForo/Model/User.php(297): XenForo_Model->fetchAllKeyed('?????SELECT use...', 'user_id')
#5 /home2/familygu/public_html/library/XenForo/ControllerPublic/Member.php(46): XenForo_Model_User->getUsers(Array, Array)
#6 /home2/familygu/public_html/library/XenForo/FrontController.php(335): XenForo_ControllerPublic_Member->actionIndex()
#7 /home2/familygu/public_html/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /home2/familygu/public_html/index.php(13): XenForo_FrontController->run()
#9 {main}
 
How peculiar... Because according to your list of add-ons in the other thread, you DO have WDB Extra Stats installed. I presumed (wrongly) that the library/ExtraStats files belonged to that.
 
Is it still on the to-do list for a fix?
I would expect any upgrade making table changes, would first test for the changes already existing before making the change and causing an SQL stop and impacting the remainder of its SQL. But I can see how this can be considered an add-ons cause for not prefixing it's DB changes, but hoping it doesn't result in finger pointing and no action :)
It's still something to be considered. It, however, creates the opposite problem: the upgrade completes as expected and you then remove the add-on (as in many cases, the conflicts come from add-ons that provide functionality similar to core features). That add-on cleans up its schema changes (as it should) and now you're missing the fields in question. That said, that's something that can theoretically happen right now as well.

The other potential issue (and yes, this can happen now as well in situations) is when add-ons add tables/fields with the same name but store different content/values.

The whole thing can consistently be avoided by add-ons prefixing their schema changes.
 
How peculiar... Because according to your list of add-ons in the other thread, you DO have WDB Extra Stats installed. I presumed (wrongly) that the library/ExtraStats files belonged to that.

I've looked closer, and it's an add-on called "User Statistics", with an id of ExtraStats, and version 0.9.1 I've searched threads and resources, but cannot narrow down an add-on by this name. It's disabled on my production server, so I'll uninstall it and check if it removes it's added index to xf_user, so that I don't have the same issue when upgrading production to 1.2

Thanks.
 
For reference of anyone else that finds this thread with the same/similar issue, un-install of the "User Statistics" ( ExtraStats ) add-on didn't remove it's db schema changes. I ran " drop index register_date on xf_user;" on my XF 1.1 database to fix the issue, so that my 1.2 upgrade won't fail.
 
Top Bottom