Updated sql - added key to log status