Console command runing from Cron job failing after Craft update 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()-&gt;elements-&gt;getCriteria(ElementType::User);

$user_criteria-&gt;userExpiryDate = date('Y-m-d',strtotime("+7 days"));

$users = $user_criteria-&gt;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?
This ended up being a case of looking at the wrong database.  The version/build/schema numbers for the correct database were all in sync.