Set the initial Auto Increment value | Drupal 8

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);

Comments

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.