You are here

function brightcove_update_8105 in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 brightcove.install \brightcove_update_8105()
  2. 3.x brightcove.install \brightcove_update_8105()

Update entity definitions.

File

./brightcove.install, line 209
Brightcove install file.

Code

function brightcove_update_8105() {

  // Migrate brightcove_video entity name field before updating the entity
  // definitions.
  $schema = Drupal::database()
    ->schema();

  /* @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $entity_definition_update_manager */
  $entity_definition_update_manager = Drupal::service('entity.definition_update_manager');
  $entity_type_manager = Drupal::entityTypeManager();
  $name_column_specifications = [
    'type' => 'varchar',
    'length' => 255,
    'not null' => TRUE,
  ];
  $entity_type_definition = $entity_type_manager
    ->getDefinition('brightcove_video');
  $schema
    ->changeField($entity_type_definition
    ->getBaseTable(), 'name', 'name', $name_column_specifications);
  $entity_definition_update_manager
    ->installEntityType($entity_type_definition);

  // Apply entity definition updates.
  \Drupal::entityDefinitionUpdateManager()
    ->applyUpdates();
}