You are here

function taxonomy_edge_update_7200 in Taxonomy Edge 7.2

Add path id to support multiple parents properly

File

./taxonomy_edge.install, line 177
Installation file for Taxonomy Edge

Code

function taxonomy_edge_update_7200() {
  $schema = drupal_get_schema('taxonomy_term_edge_path');
  db_create_table('taxonomy_term_edge_path', $schema);
  $schema = drupal_get_schema('taxonomy_term_edge_order');
  db_create_table('taxonomy_term_edge_order', $schema);
  db_truncate('taxonomy_term_edge')
    ->execute();
  db_drop_primary_key('taxonomy_term_edge');
  db_drop_index('taxonomy_term_edge', 'idx_term');
  db_drop_index('taxonomy_term_edge', 'idx_parent');
  db_drop_field('taxonomy_term_edge', 'tid');
  db_add_field('taxonomy_term_edge', 'pid', array(
    'description' => 'Path ID',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_index('taxonomy_term_edge', 'idx_update', array(
    'parent',
    'pid',
  ));
  db_add_index('taxonomy_term_edge', 'idx_path', array(
    'pid',
    'parent',
    'distance',
  ));
  db_add_index('taxonomy_term_edge', 'idx_build', array(
    'distance',
    'pid',
  ));
  db_add_index('taxonomy_term_edge', 'idx_depth', array(
    'vid',
    'distance',
  ));
}