From 029249c2b03c70fd63838a7aa18dd7f7f0d15053 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 5 Jul 2026 13:23:52 +0200 Subject: [PATCH] Fix Database Reset Signed-off-by: Chaoscaot --- CLI/src/commands/database/ResetCommand.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CLI/src/commands/database/ResetCommand.kt b/CLI/src/commands/database/ResetCommand.kt index d707c1a7..e7fe1688 100644 --- a/CLI/src/commands/database/ResetCommand.kt +++ b/CLI/src/commands/database/ResetCommand.kt @@ -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!"))) } }