You are here

function subscriptions_update_6 in Subscriptions 5.2

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

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

File

./subscriptions.install, line 423

Code

function subscriptions_update_6() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD autosub_on_post tinyint NOT NULL default -1 AFTER send_comments_visible");
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD autosub_on_update tinyint NOT NULL default -1 AFTER autosub_on_post");
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD autosub_on_comment tinyint NOT NULL default -1 AFTER autosub_on_update");
      $ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_self tinyint NOT NULL default -1 AFTER autosub_on_comment");
      break;
    case 'pgsql':
      db_add_column($ret, 'subscriptions_user', 'autosub_on_post', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_user', 'autosub_on_update', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_user', 'autosub_on_comment', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      db_add_column($ret, 'subscriptions_user', 'send_self', 'smallint', array(
        'default' => -1,
        'not null' => TRUE,
      ));
      break;
  }
  return $ret;
}