You are here

function taxonomy_entity_index_update_7001 in Taxonomy Entity Index 7

Shorten the entity_type field to 32 characters and add the field_name field.

File

./taxonomy_entity_index.install, line 90

Code

function taxonomy_entity_index_update_7001() {

  // We will need to drop the primary key since we are changing one of its
  // field lengths.
  db_drop_primary_key('taxonomy_entity_index');

  // Shorten the entity_type field to 32 chars.
  db_change_field('taxonomy_entity_index', 'entity_type', 'entity_type', array(
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
  ));

  // Add the field_name field.
  db_add_field('taxonomy_entity_index', 'field_name', array(
    'description' => 'The field name the term is attached to.',
    'type' => 'varchar',
    'length' => 32,
    'not null' => TRUE,
    'default' => '',
  ));

  // Re-add the primary key.
  db_add_primary_key('taxonomy_entity_index', array(
    'entity_type',
    'entity_id',
    'revision_id',
    'field_name',
    'delta',
  ));
}