mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Improve MySQL test performance
This commit is contained in:
parent
3c884f521b
commit
b660508009
1 changed files with 3 additions and 4 deletions
|
@ -59,14 +59,13 @@ trait MySQL {
|
||||||
if ($table === "arsse_meta") {
|
if ($table === "arsse_meta") {
|
||||||
$db->query("DELETE FROM $table where `key` <> 'schema_version'");
|
$db->query("DELETE FROM $table where `key` <> 'schema_version'");
|
||||||
} else {
|
} 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) {
|
foreach ($afterStatements as $st) {
|
||||||
$db->query($st);
|
$db->query($st);
|
||||||
}
|
}
|
||||||
|
$db->query("SET FOREIGN_KEY_CHECKS=1");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dbRaze($db, array $afterStatements = []): void {
|
public static function dbRaze($db, array $afterStatements = []): void {
|
||||||
|
@ -79,9 +78,9 @@ trait MySQL {
|
||||||
foreach (self::dbTableList($db) as $table) {
|
foreach (self::dbTableList($db) as $table) {
|
||||||
$db->query("DROP TABLE IF EXISTS $table");
|
$db->query("DROP TABLE IF EXISTS $table");
|
||||||
}
|
}
|
||||||
$db->query("SET FOREIGN_KEY_CHECKS=1");
|
|
||||||
foreach ($afterStatements as $st) {
|
foreach ($afterStatements as $st) {
|
||||||
$db->query($st);
|
$db->query($st);
|
||||||
}
|
}
|
||||||
|
$db->query("SET FOREIGN_KEY_CHECKS=1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue