[#934, #939] Attempt to fix broken databases

This commit is contained in:
Rsl1122 2019-03-03 18:46:28 +02:00
parent fd2e45b204
commit 1c4938a3db

View File

@ -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));