You are here

function profile_install in Drupal 5

Same name and namespace in other branches
  1. 6 modules/profile/profile.install \profile_install()

Implementation of hook_install().

File

modules/profile/profile.install, line 6

Code

function profile_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {profile_fields} (\n        fid int NOT NULL auto_increment,\n        title varchar(255) default NULL,\n        name varchar(128) default NULL,\n        explanation TEXT,\n        category varchar(255) default NULL,\n        page varchar(255) default NULL,\n        type varchar(128) default NULL,\n        weight tinyint DEFAULT '0' NOT NULL,\n        required tinyint DEFAULT '0' NOT NULL,\n        register tinyint DEFAULT '0' NOT NULL,\n        visibility tinyint DEFAULT '0' NOT NULL,\n        autocomplete tinyint DEFAULT '0' NOT NULL,\n        options text,\n        KEY category (category),\n        UNIQUE KEY name (name),\n        PRIMARY KEY (fid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      db_query("CREATE TABLE {profile_values} (\n        fid int unsigned default '0',\n        uid int unsigned default '0',\n        value text,\n        KEY uid (uid),\n        KEY fid (fid)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      break;
    case 'pgsql':
      db_query("CREATE TABLE {profile_fields} (\n        fid serial,\n        title varchar(255) default NULL,\n        name varchar(128) default NULL,\n        explanation TEXT default NULL,\n        category varchar(255) default NULL,\n        page varchar(255) default NULL,\n        type varchar(128) default NULL,\n        weight smallint DEFAULT '0' NOT NULL,\n        required smallint DEFAULT '0' NOT NULL,\n        register smallint DEFAULT '0' NOT NULL,\n        visibility smallint DEFAULT '0' NOT NULL,\n        autocomplete smallint DEFAULT '0' NOT NULL,\n        options text,\n        UNIQUE (name),\n        PRIMARY KEY (fid)\n      )");
      db_query("CREATE INDEX {profile_fields}_category_idx ON {profile_fields} (category)");
      db_query("CREATE TABLE {profile_values} (\n        fid int_unsigned default '0',\n        uid int_unsigned default '0',\n        value text\n      )");
      db_query("CREATE INDEX {profile_values}_uid_idx ON {profile_values} (uid)");
      db_query("CREATE INDEX {profile_values}_fid_idx ON {profile_values} (fid)");
      break;
  }
}