You are here

function lingotek_update_7509 in Lingotek Translation 7.6

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

Reduce the size of current value field in the lingotek_entity_metadata table

File

./lingotek.install, line 879

Code

function lingotek_update_7509(&$sandbox) {
  $table = 'lingotek_entity_metadata';
  $entity_value_spec = array(
    'description' => 'Value for the specified key.',
    'type' => 'varchar',
    'length' => 128,
    'not null' => TRUE,
    'default' => '',
  );
  $indexes = array(
    'idx_entity_key_and_value' => array(
      'entity_key',
      'value',
    ),
  );

  // drop the related index
  foreach ($indexes as $index_name => $fields) {
    db_drop_index($table, $index_name);
  }

  // update the field to be 128 instead of 255
  db_change_field($table, 'value', 'value', $entity_value_spec);

  // add back related index
  foreach ($indexes as $index_name => $fields) {
    db_add_index($table, $index_name, $fields);
  }
  return t('Reduced field size of value column in the Lingotek entity metadata table.');
}