You are here

function node_update_8002 in Drupal 8

Remove obsolete indexes from the node schema.

File

core/modules/node/node.install, line 183
Install, update and uninstall functions for the node module.

Code

function node_update_8002() {

  // The "node__default_langcode" and "node_field__langcode" indexes were
  // removed from \Drupal\node\NodeStorageSchema in
  // https://www.drupal.org/node/2261669, but this update function wasn't
  // added until https://www.drupal.org/node/2542748. Regenerate the related
  // schemas to ensure they match the currently expected status.
  $manager = \Drupal::entityDefinitionUpdateManager();

  // Regenerate entity type indexes, this should drop "node__default_langcode".
  $manager
    ->updateEntityType($manager
    ->getEntityType('node'));

  // Regenerate "langcode" indexes, this should drop "node_field__langcode".
  $manager
    ->updateFieldStorageDefinition($manager
    ->getFieldStorageDefinition('langcode', 'node'));
}