forked from SteamWar/SteamWar
@@ -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!")))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user