From b6605080096918c8d6f8378aa6c31db0dbc2b5bb Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 30 Dec 2021 18:22:50 -0500 Subject: [PATCH] Improve MySQL test performance --- tests/lib/DatabaseDrivers/MySQL.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/lib/DatabaseDrivers/MySQL.php b/tests/lib/DatabaseDrivers/MySQL.php index 0df43d3f..9363a59f 100644 --- a/tests/lib/DatabaseDrivers/MySQL.php +++ b/tests/lib/DatabaseDrivers/MySQL.php @@ -59,14 +59,13 @@ trait MySQL { if ($table === "arsse_meta") { $db->query("DELETE FROM $table where `key` <> 'schema_version'"); } else { - $db->query("DELETE FROM $table"); + $db->query("TRUNCATE TABLE $table"); } - $db->query("ALTER TABLE $table auto_increment = 1"); } - $db->query("SET FOREIGN_KEY_CHECKS=1"); foreach ($afterStatements as $st) { $db->query($st); } + $db->query("SET FOREIGN_KEY_CHECKS=1"); } public static function dbRaze($db, array $afterStatements = []): void { @@ -79,9 +78,9 @@ trait MySQL { foreach (self::dbTableList($db) as $table) { $db->query("DROP TABLE IF EXISTS $table"); } - $db->query("SET FOREIGN_KEY_CHECKS=1"); foreach ($afterStatements as $st) { $db->query($st); } + $db->query("SET FOREIGN_KEY_CHECKS=1"); } }