function system_update_10101

Change the {batch} table [bid] field to serial.

File

core/modules/system/system.install, line 1842

Code

function system_update_10101(&$sandbox = NULL) {
  $connection = \Drupal::database();
  $schema = $connection->schema();
  // Update batch table.
  if ($schema->tableExists('batch')) {
    $schema->changeField('batch', 'bid', 'bid', [
      'description' => 'Primary Key: Unique batch ID.',
      'type' => 'serial',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ]);
  }
}

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