I have had a custom console command running fine for several months now which sent out reminder emails to users when there accounts are about to expire.
After the latest Craft update (I believe) it stopped working. Here is the error:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054
Unknown column 'users.locked' in 'field list'
exception 'CDbException' with message 'CDbCommand failed to execute the SQL statement:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.locked' in 'field list'' in CDbCommand.php:543
The lines of code from the plugin service which cause the error are:
$user_criteria = craft()->elements->getCriteria(ElementType::User);
$user_criteria->userExpiryDate = date('Y-m-d',strtotime("+7 days"));
$users = $user_criteria->find();
Basically it fails when running the find() method.
Strangely I haven't managed to replicate the error on my local machine.
Does anyone have any idea what might be causing this?
craft/app/Info.php
and file and compare that to you the schemaVersion and build in thecraft_info
table in the database. If those don't match then your database schema is out of sync with the code you're running.