Skip to content

Commit

Permalink
Merge branch '5.2' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 22, 2024
2 parents d14ec28 + 4693e3f commit 8a576f9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/ORM/Connect/MySQLDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,16 +566,6 @@ public function random()
*/
public function clearTable($table)
{
$this->query("DELETE FROM \"$table\"");

// Check if resetting the auto-increment is needed
$autoIncrement = $this->preparedQuery(
'SELECT "AUTO_INCREMENT" FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
[ $this->getSelectedDatabase(), $table]
)->value();

if ($autoIncrement > 1) {
$this->query("ALTER TABLE \"$table\" AUTO_INCREMENT = 1");
}
$this->query("TRUNCATE TABLE \"$table\"");
}
}

0 comments on commit 8a576f9

Please sign in to comment.