You are here

function notifications_update_6002 in Notifications 6.2

Same name and namespace in other branches
  1. 6.4 notifications.install \notifications_update_6002()
  2. 6 notifications.install \notifications_update_6002()
  3. 6.3 notifications.install \notifications_update_6002()

Add some fields

File

./notifications.install, line 339

Code

function notifications_update_6002() {
  $ret = array();
  db_add_field($ret, 'notifications_event', 'counter', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'disp-width' => '11',
  ));
  db_add_field($ret, 'notifications', 'destination', array(
    'type' => 'varchar',
    'length' => '255',
    'not null' => FALSE,
  ));
  db_add_field($ret, 'notifications_queue', 'destination', array(
    'type' => 'varchar',
    'length' => '255',
    'not null' => FALSE,
  ));

  // Update event counter, this may take a while
  $ret[] = update_sql("UPDATE {notifications_event} e SET counter = (SELECT COUNT(*) FROM {notifications_queue} q WHERE q.eid = e.eid)");
  return $ret;
}