You are here

function spam_update_5301 in Spam 5.3

Add trid field to spam_log table.

File

./spam.install, line 390

Code

function spam_update_5301() {

  // Update contontained in _5300 if updating from 5.x-1.x spam module.
  if (spam_skip_update()) {
    return array();
  }
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    default:
      $ret[] = update_sql("ALTER TABLE {spam_log} ADD trid int(11) UNSIGNED NOT NULL DEFAULT '0' AFTER lid");
      $ret[] = update_sql("ALTER TABLE {spam_log} ADD INDEX trid (trid)");
      break;
    case 'pgsql':
      db_add_column($ret, 'spam_log', 'trid', 'int', array(
        'not null' => TRUE,
        'default' => "'0'",
      ));
      $ret[] = update_sql("CREATE INDEX {spam_log}_trid_key ON {spam_log} (trid);");
      break;
  }
  return $ret;
}