You are here

function tmgmt_smartling_update_8402 in TMGMT Translator Smartling 8.4

Add missing job_file_content_hash column to tmgmt_job table if does not exist yet.

File

./tmgmt_smartling.install, line 166
Update function for the tmgmt_smartling module.

Code

function tmgmt_smartling_update_8402() {
  $entity_definition_manager = Drupal::entityDefinitionUpdateManager();
  $schema = Database::getConnection()
    ->schema();
  if (!$schema
    ->fieldExists("tmgmt_job", "job_file_content_hash")) {
    $field_storage_definition = BaseFieldDefinition::create('string')
      ->setLabel(t('File content hash (md5)'))
      ->setSetting('max_length', 32)
      ->setTranslatable(FALSE);
    $entity_definition_manager
      ->installFieldStorageDefinition('job_file_content_hash', 'tmgmt_job', 'tmgmt_smartling', $field_storage_definition);
  }
}