You are here

function subscriptions_update_5 in Subscriptions 5.2

Same name and namespace in other branches
  1. 6 subscriptions.install \subscriptions_update_5()

Database update function 5 for 5.x-2.0 rewrite.

File

./subscriptions.install, line 398

Code

function subscriptions_update_5() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_interval_visible tinyint NOT NULL default -1 AFTER send_comments");
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_updates_visible tinyint NOT NULL default -1 AFTER send_interval_visible");
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_comments_visible tinyint NOT NULL default -1 AFTER send_updates_visible");
      $ret[] = update_sql("ALTER TABLE {subscriptions_queue} ADD is_new tinyint AFTER load_function");
      break;
    case 'pgsql':
      db_add_column($ret, 'subscriptions_user', 'send_interval_visible', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_user', 'send_updates_visible', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_user', 'send_comments_visible', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_queue', 'is_new', 'smallint');
      break;
  }
  $ret[] = update_sql("UPDATE {subscriptions_user} SET send_interval_visible = 0, send_updates_visible = 0, send_comments_visible = 0 WHERE uid = " . -DRUPAL_AUTHENTICATED_RID);
  return $ret;
}