You are here

function subscriptions_update_1 in Subscriptions 5.2

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

Database update function 1 for first incarnation of 5.x-2.0.

File

./subscriptions.install, line 191

Code

function subscriptions_update_1() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE {subscriptions_mail_edit} (\n          mailkey varchar(255) NOT NULL,\n          item_body TEXT,\n          PRIMARY KEY (mailkey)\n         ) /*!40100 DEFAULT CHARACTER SET utf8 */");
      $ret[] = update_sql("ALTER TABLE {subscriptions} ADD send_interval int(10) unsigned default '0' NOT NULL");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {subscriptions_mail_edit} (\n          mailkey varchar(255) NOT NULL,\n          item_body TEXT,\n          PRIMARY KEY (mailkey)\n        )");
      db_add_column($ret, 'subscriptions', 'send_interval', 'integer', array(
        'default' => 0,
        'not null' => TRUE,
      ));
      break;
  }
  if (variable_get('subscriptions_usecron', 0)) {
    $ret[] = update_sql("UPDATE {subscriptions} SET send_interval = 1");
  }
  variable_del('subscriptions_usecron');
  return $ret;
}