function dblog_update_12100

Change the 'wid' of the 'watchdog' table to an unsigned big integer.

File

core/modules/dblog/dblog.install, line 120

Code

function dblog_update_12100() : void {
  $connection = \Drupal::database();
  // Remove the - extreme case - rows that have a negative WID.
  $connection->delete('watchdog')
    ->condition('wid', 0, '<')
    ->execute();
  $connection->schema()
    ->changeField('watchdog', 'wid', 'wid', [
    'size' => 'big',
    'type' => 'serial',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'description' => 'Primary Key: Unique watchdog event ID.',
  ]);
}

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