You are here

profile.install in Drupal 5

Same filename and directory in other branches
  1. 6 modules/profile/profile.install
  2. 7 modules/profile/profile.install

File

modules/profile/profile.install
View source
<?php

/**
 * Implementation of hook_install().
 */
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;
  }
}

/**
 * Implementation of hook_uninstall().
 */
function profile_uninstall() {
  db_query('DROP TABLE {profile_fields}');
  db_query('DROP TABLE {profile_values}');
  variable_del('profile_block_author_fields');
}

Functions

Namesort descending Description
profile_install Implementation of hook_install().
profile_uninstall Implementation of hook_uninstall().