You are here

function lingotek_update_7504 in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.install \lingotek_update_7504()
  2. 7.6 lingotek.install \lingotek_update_7504()

Add indexes to the lingotek_entity_metadata table

File

./lingotek.install, line 775

Code

function lingotek_update_7504(&$sandbox) {
  lingotek_extend_metadata_tables();
  $table = 'lingotek_entity_metadata';
  $indexes = array(
    'idx_entity_id' => array(
      'entity_id',
    ),
    'idx_entity_key' => array(
      'entity_key',
    ),
    'idx_entity_type_and_key' => array(
      'entity_type',
      'entity_key',
    ),
    'idx_entity_key_and_value' => array(
      'entity_key',
      'value',
    ),
  );
  foreach ($indexes as $index_name => $fields) {
    if (!db_index_exists($table, $index_name)) {
      db_add_index($table, $index_name, $fields);
    }
  }
  return t('Added indexes to the <i>lingotek_entity_metadata</i> table.');
}