You are here

function update_create_cache_tables in Drupal 5

Create tables for the split cache.

This is part of the Drupal 4.7.x to 5.x migration.

1 call to update_create_cache_tables()
update.php in ./update.php
Administrative page for handling updates from one Drupal version to another.

File

./update.php, line 692
Administrative page for handling updates from one Drupal version to another.

Code

function update_create_cache_tables() {

  // If cache_filter exists, update is not necessary
  if (db_table_exists('cache_filter')) {
    return;
  }
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql("CREATE TABLE {cache_filter} (\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 */ ");
      $ret[] = update_sql("CREATE TABLE {cache_menu} (\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 */ ");
      $ret[] = update_sql("CREATE TABLE {cache_page} (\n        cid varchar(255) BINARY 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 */ ");
      break;
    case 'pgsql':
      $ret[] = update_sql("CREATE TABLE {cache_filter} (\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     )");
      $ret[] = update_sql("CREATE TABLE {cache_menu} (\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     )");
      $ret[] = update_sql("CREATE TABLE {cache_page} (\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     )");
      $ret[] = update_sql("CREATE INDEX {cache_filter}_expire_idx ON {cache_filter} (expire)");
      $ret[] = update_sql("CREATE INDEX {cache_menu}_expire_idx ON {cache_menu} (expire)");
      $ret[] = update_sql("CREATE INDEX {cache_page}_expire_idx ON {cache_page} (expire)");
      break;
  }
  return $ret;
}