You are here

function menu_entity_index_update_8101 in Menu Entity Index 8

Adds langcode fields to primary index of menu_entity_index database table.

File

./menu_entity_index.install, line 147
Hooks related to (un-)installation of Menu Entity Index module.

Code

function menu_entity_index_update_8101() {
  $table = 'menu_entity_index';
  $index = 'PRIMARY';
  $schema = Database::getConnection()
    ->schema();
  if ($schema) {
    if ($schema
      ->tableExists($table)) {
      if ($schema
        ->indexExists($table, $index)) {
        $schema
          ->dropIndex($table, $index);
      }
      $schema
        ->addPrimaryKey($table, [
        'menu_name',
        'entity_uuid',
        'parent_uuid',
        'target_uuid',
        'langcode',
        'target_langcode',
      ]);
    }
  }
}