Fix Database Reset

Signed-off-by: Chaoscaot <max@maxsp.de>
This commit is contained in:
2026-07-05 13:23:52 +02:00
parent 1ceb10439b
commit 029249c2b0
+5 -1
View File
@@ -22,9 +22,11 @@ class ResetCommand : CliktCommand() {
val schema = schemaFile.readText()
execute("SET FOREIGN_KEY_CHECKS=0;") { }
val tables = execute("SHOW TABLES;") { it.getString(1) }
for (table in tables) {
execute("DROP TABLE IF EXISTS $table;") { }
execute("DROP TABLE IF EXISTS `${table.replace("`", "``")}`;") { }
}
execute(schema) { }
@@ -34,6 +36,8 @@ class ResetCommand : CliktCommand() {
execute(seed.readText()) { }
execute("SET FOREIGN_KEY_CHECKS=1;") { }
echo(TextColors.brightGreen(TextStyles.bold("Database reset!")))
}
}