function subscriptions_update_4 in Subscriptions 5.2
Same name and namespace in other branches
- 6 subscriptions.install \subscriptions_update_4()
Database update function 4 for 5.x-2.0 rewrite.
File
- ./
subscriptions.install, line 373
Code
function subscriptions_update_4() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_interval int NOT NULL default -1 AFTER digest");
$ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_updates tinyint NOT NULL default -1 AFTER send_interval");
$ret[] = update_sql("ALTER TABLE {subscriptions_user} ADD send_comments tinyint NOT NULL default -1 AFTER send_updates");
break;
case 'pgsql':
db_add_column($ret, 'subscriptions_user', 'send_interval', 'integer', array(
'default' => -1,
'not null' => TRUE,
));
db_add_column($ret, 'subscriptions_user', 'send_updates', 'smallint', array(
'default' => -1,
'not null' => TRUE,
));
db_add_column($ret, 'subscriptions_user', 'send_comments', 'smallint', array(
'default' => -1,
'not null' => TRUE,
));
break;
}
$ret[] = update_sql("DELETE FROM {subscriptions_user} WHERE uid = 0");
$ret[] = update_sql("UPDATE {subscriptions_user} SET digest = -1");
$ret[] = update_sql("INSERT INTO {subscriptions_user} (uid, digest, send_interval, send_updates, send_comments) VALUES(" . -DRUPAL_AUTHENTICATED_RID . ", 0, 1, 0, 0)");
return $ret;
}