You are here

function commerce_order_update_8204 in Commerce Core 8.2

Add the 'uses_legacy_adjustments' field to 'commerce_order_item' entities.

File

modules/order/commerce_order.install, line 84
Install, update and uninstall functions for the Order module.

Code

function commerce_order_update_8204() {
  $storage_definition = BaseFieldDefinition::create('boolean')
    ->setLabel(t('Uses legacy adjustments'))
    ->setSettings([
    'on_label' => t('Yes'),
    'off_label' => t('No'),
  ])
    ->setDefaultValue(FALSE)
    ->setInitialValue(TRUE);
  $update_manager = \Drupal::entityDefinitionUpdateManager();
  $update_manager
    ->installFieldStorageDefinition('uses_legacy_adjustments', 'commerce_order_item', 'commerce_order', $storage_definition);
}