You are here

function maestro_update_8002 in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 maestro.install \maestro_update_8002()

Update 8002 - Add timestamp field to maestro_process_status entity.

File

./maestro.install, line 47
Install, update and uninstall functions for the Maestro module.

Code

function maestro_update_8002() {
  if (!\Drupal::entityDefinitionUpdateManager()
    ->getFieldStorageDefinition('completed', 'maestro_process_status')) {
    $storage_definition = BaseFieldDefinition::create('integer')
      ->setLabel(t('Completed'))
      ->setDescription(t('The time that the task associated to this status was completed.'))
      ->setSettings([
      'default_value' => '0',
    ]);
    \Drupal::entityDefinitionUpdateManager()
      ->installFieldStorageDefinition('completed', 'maestro_process_status', 'maestro_process_status', $storage_definition);
  }
  else {
    return 'Completed field already exists in maestro_process_status';
  }
}