You are here

function log_update_7002 in Log entity 7

Add 'done' fields to Logs and Log Types.

Parameters

array $sandbox: The update sandbox array.

File

./log.install, line 192
Log install.

Code

function log_update_7002(array &$sandbox) {

  // Add done field to Logs and Log Types.
  $done = array(
    'description' => 'Boolean: automatically mark logs of this type as done.',
    'type' => 'int',
    'size' => 'tiny',
    'not null' => TRUE,
    'default' => 0,
  );
  db_add_field('log', 'done', $done);
  db_add_field('log_type', 'done', $done);
  db_add_index('log', 'done', array(
    'done',
  ));

  // Mark all existing log items with timestamps before now as "done".
  db_query('UPDATE {log} SET done = 1 WHERE timestamp <= :now', array(
    ':now' => REQUEST_TIME,
  ));
}