You are here

function gmap_taxonomy_update_5002 in GMap Module 5

Stop tracking vid, term_node associations are not revisioned in Drupal 5. See #295775.

File

./gmap_taxonomy.install, line 50

Code

function gmap_taxonomy_update_5002() {
  $ret = array();
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':

      // Just drop the table. It's not worth diddling around with the keys.
      $ret[] = update_sql("DROP TABLE {gmap_taxonomy_node}");
      $ret[] = update_sql("CREATE TABLE {gmap_taxonomy_node} (\n        nid int(10) unsigned NOT NULL default '0',\n        tid int(10) unsigned NOT NULL default '0',\n        marker varchar(32),\n        PRIMARY KEY nid(nid),\n        INDEX nid(nid)\n        ) /*!40100 DEFAULT CHARACTER SET utf8 */");

      // Recreate the data.
      // Useful for repopulating in bulk... Copy to hook_enable()?
      $ret[] = update_sql("INSERT INTO {gmap_taxonomy_node} (nid, tid, marker) (SELECT t.nid, t.tid, g.marker FROM {term_node} t INNER JOIN {gmap_taxonomy_term} g ON t.tid = g.tid GROUP BY t.nid ORDER BY NULL)");
      break;
    case 'pgsql':

      // This update will never be needed for pgsql, as it predates pgsql support.
      break;
  }
  if (function_exists('views_invalidate_cache')) {

    // Rub a horseshoe for good luck.
    views_invalidate_cache();
  }
  return $ret;
}