You are here

function invite_install in Invite 5

Same name and namespace in other branches
  1. 8 invite.install \invite_install()
  2. 5.2 invite.install \invite_install()
  3. 6.2 invite.install \invite_install()
  4. 7.4 invite.install \invite_install()

Install the initial schema.

File

./invite.install, line 6

Code

function invite_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("\n        CREATE TABLE {invite} (\n          email varchar(64) NOT NULL default '',\n          reg_code varchar(64) NOT NULL default '',\n          uid int(10) unsigned NOT NULL default '0',\n          mid int(11) unsigned NOT NULL default '0',\n          expiry int(11) NOT NULL default '0',\n          timestamp int(11) NOT NULL default '0',\n          received tinyint(3) unsigned NOT NULL default '0',\n          data text NOT NULL,\n          PRIMARY KEY  (email),\n          UNIQUE (reg_code),\n          KEY (uid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      db_query("\n        CREATE TABLE {invite} (\n          email VARCHAR(64) NOT NULL DEFAULT '',\n          reg_code VARCHAR(64) NOT NULL DEFAULT '',\n          uid INTEGER NOT NULL DEFAULT 0,\n          mid INTEGER NOT NULL DEFAULT 0,\n          expiry INTEGER NOT NULL DEFAULT 0,\n          timestamp INTEGER NOT NULL DEFAULT 0,\n          received SMALLINT NOT NULL DEFAULT 0,\n          data TEXT NOT NULL DEFAULT '',\n          PRIMARY KEY (email),\n          UNIQUE (reg_code)\n        );");
      db_query("CREATE INDEX {invite}_uid_idx ON {invite} (uid)");
      break;
  }
}