function invite_update_200 in Invite 5.2
Same name and namespace in other branches
- 6.2 invite.install \invite_update_200()
- 7.2 invite.install \invite_update_200()
1. Allow multiple invitations for the same e-mail address. 2. Changed some column names to be more descriptive. 3. Added a column to flag canceled invites. 4. Added resent column.
File
- ./
invite.install, line 381 - Installation file for invite module.
Code
function invite_update_200() {
$ret = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {invite} DROP PRIMARY KEY, ADD INDEX email (email)");
$ret[] = update_sql("ALTER TABLE {invite} CHANGE mid invitee int(10) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {invite} CHANGE timestamp joined int(10) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {invite} ADD created int(10) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {invite} ADD canceled tinyint(1) NOT NULL default '0'");
$ret[] = update_sql("ALTER TABLE {invite} ADD resent tinyint(3) NOT NULL default '0'");
break;
case 'pgsql':
$ret[] = update_sql("ALTER TABLE {invite} DROP CONSTRAINT {invite}_pkey");
$ret[] = update_sql("CREATE INDEX {invite}_email_idx ON {invite}(email)");
db_change_column($ret, 'invite', 'mid', 'invitee', 'INTEGER', array(
'not null' => TRUE,
'default' => 0,
));
db_change_column($ret, 'invite', 'timestamp', 'joined', 'INTEGER', array(
'not null' => TRUE,
'default' => 0,
));
db_add_column($ret, 'invite', 'created', 'INTEGER', array(
'default' => 0,
'not null' => TRUE,
));
db_add_column($ret, 'invite', 'canceled', 'SMALLINT', array(
'default' => 0,
'not null' => TRUE,
));
db_add_column($ret, 'invite', 'resent', 'SMALLINT', array(
'default' => 0,
'not null' => TRUE,
));
break;
}
return $ret;
}