You are here

function taxonomy_edge_schema in Taxonomy Edge 7.2

Same name and namespace in other branches
  1. 8 taxonomy_edge.install \taxonomy_edge_schema()
  2. 6 taxonomy_edge.install \taxonomy_edge_schema()
  3. 7 taxonomy_edge.install \taxonomy_edge_schema()

Implements hook_schema().

File

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

Code

function taxonomy_edge_schema() {
  $schema['taxonomy_term_edge_path'] = array(
    'description' => 'Stores paths for taxonomies.',
    'fields' => array(
      'pid' => array(
        'description' => 'Path ID',
        'type' => 'serial',
      ),
      'tid' => array(
        'description' => 'Term ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'vid' => array(
        'description' => 'Vocabulary ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'temp_pid' => array(
        'description' => 'Temporary Path ID for updates',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'pid',
    ),
    'indexes' => array(
      'idx_update' => array(
        'vid',
        'temp_pid',
      ),
      'idx_order' => array(
        'pid',
        'tid',
      ),
      'idx_term' => array(
        'tid',
        'pid',
      ),
    ),
  );
  $schema['taxonomy_term_edge'] = array(
    'description' => 'Stores edge list for taxonomies.',
    'fields' => array(
      'eid' => array(
        'description' => 'Edge ID',
        'type' => 'serial',
      ),
      'vid' => array(
        'description' => 'Vocabulary ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'Path ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'parent' => array(
        'description' => 'Parent Term ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'distance' => array(
        'description' => 'Distance to parent (depth)',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'eid',
    ),
    'unique keys' => array(
      'idx_node' => array(
        'pid',
        'distance',
      ),
    ),
    'indexes' => array(
      'idx_update' => array(
        'parent',
        'pid',
      ),
      'idx_path' => array(
        'pid',
        'parent',
        'distance',
      ),
      'idx_build' => array(
        'distance',
        'pid',
      ),
      'idx_depth' => array(
        'vid',
        'distance',
      ),
    ),
  );
  $schema['taxonomy_term_edge_order'] = array(
    'description' => 'Sequencing table for sorting taxonomies.',
    'fields' => array(
      'oid' => array(
        'description' => 'Order ID',
        'type' => 'serial',
      ),
      'vid' => array(
        'description' => 'Vocabulary ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'pid' => array(
        'description' => 'Path ID',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'oid',
    ),
    'indexes' => array(
      'idx_vocab' => array(
        'vid',
        'oid',
        'pid',
      ),
    ),
  );
  return $schema;
}