Set the initial Auto Increment value

Submitted by editor on Tue, 01/12/2016 - 15:12
Question

How to set the  initial AUTO_INCREMENT value of a mysql table ?

Example:

  $con = Drupal\Core\Database\Database::getConnection();
  $start_value = 100000;
  $query = "ALTER TABLE {the_table} AUTO_INCREMENT = $start_value";
  $con->query($query);

Add new comment