From 1c4938a3dbf77266cf028fd92effdb632b5ca7af Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 3 Mar 2019 18:46:28 +0200 Subject: [PATCH] [#934, #939] Attempt to fix broken databases --- .../plan/db/patches/KillsOptimizationPatch.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/patches/KillsOptimizationPatch.java b/Plan/common/src/main/java/com/djrapitops/plan/db/patches/KillsOptimizationPatch.java index 0a60c8763..4a1461136 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/patches/KillsOptimizationPatch.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/patches/KillsOptimizationPatch.java @@ -43,6 +43,15 @@ public class KillsOptimizationPatch extends Patch { @Override protected void applyPatch() { try { + if (hasTable(tempTableName) && hasColumn(tempTableName, KillsTable.VICTIM_UUID)) { + // In this case a patch has made a table with almost correct schema to a temporary table. + renameTable(tempTableName, tableName); + return; + } else if (hasColumn(tableName, KillsTable.VICTIM_UUID)) { + // In this case a patch has made a table with almost correct schema, but something is not right. + return; + } + tempOldTable(); execute(KillsTable.createTableSQL(dbType));