Merge branch '5.2' into 5

This commit is contained in:
github-actions 2024-07-22 21:57:05 +00:00
commit 8a576f91be

View File

@ -566,16 +566,6 @@ class MySQLDatabase extends Database implements TransactionManager
*/ */
public function clearTable($table) public function clearTable($table)
{ {
$this->query("DELETE FROM \"$table\""); $this->query("TRUNCATE TABLE \"$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");
}
} }
} }