function node_update_8002

Remove obsolete indexes from the node schema.

File

core/modules/node/node.install, line 183

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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.