You are here

function masquerade_install in Masquerade 5

Same name and namespace in other branches
  1. 6 masquerade.install \masquerade_install()
  2. 7 masquerade.install \masquerade_install()

Implementation of hook_install().

File

./masquerade.install, line 12
masquerade.install

Code

function masquerade_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE {masquerade} (\n          sid varchar(64) NOT NULL default '',\n          uid_from int(10) NOT NULL default 0,\n          uid_as int(10) NOT NULL default 0,\n          KEY (sid, uid_from),\n          KEY (sid, uid_as)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      drupal_set_message(t('The required database tables for Masquerade module were created successfully.'));
      break;
    case 'pgsql':
      db_query("CREATE TABLE {masquerade} (\n        sid varchar(64) NOT NULL default '',\n        uid_from numeric(10) NOT NULL default 0,\n        uid_as numeric(10) NOT NULL default 0\n      );");
      db_query("CREATE INDEX idx_masquerade_sid_uid_from ON {masquerade} (sid, uid_from);");
      db_query("CREATE INDEX idx_masquerade_sid_uid_as ON {masquerade} (sid, uid_as);");
      drupal_set_message(t('The required database tables for Masquerade module were created successfully.'));
      break;
  }
}