You are here

function similarterms_update_5001 in Similar By Terms 5

Implementation of hook_update().

File

./similarterms.install, line 77
Similar By Terms install file

Code

function similarterms_update_5001() {
  $return = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $return[] = update_sql("CREATE TABLE {cache_similarterms} (\n        cid varchar(255) NOT NULL default '',\n        data longblob,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid),\n        INDEX expire (expire)\n      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
      $return[] = update_sql("CREATE TABLE IF NOT EXISTS {similarterms_override} (\n        nid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n        path INT(10) UNSIGNED NOT NULL,\n        vid INT(10) UNSIGNED NOT NULL DEFAULT '0',\n        KEY (nid),\n        KEY(vid)\n      ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
      break;
    case 'pgsql':
      $return[] = update_sql("CREATE TABLE {cache_similarterms} (\n        cid varchar(255) NOT NULL default '',\n        data bytea,\n        expire int NOT NULL default '0',\n        created int NOT NULL default '0',\n        headers text,\n        PRIMARY KEY (cid)\n      )");
      $return[] = update_sql("CREATE INDEX {cache_similarterms}_expire_idx ON {cache_similarterms} (expire)");
      $return[] = update_sql("CREATE TABLE {similarterms_override} (\n        nid int NOT NULL DEFAULT '0',\n        path int NOT NULL,\n        vid int NOT NULL DEFAULT '0'\n      )");
      $return[] = update_sql("CREATE INDEX {similarterms_override}_nid_idx ON {similarterms_override} (nid)");
      $return[] = update_sql("CREATE INDEX {similarterms_override}_vid_idx ON {similarterms_override} (vid)");
      break;
  }
  return $return;
}