mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
We do enjoy killing off orphans
This commit is contained in:
parent
d1a7ce827a
commit
9678875b4b
@ -151,6 +151,7 @@ public final class SQLDatabaseManager {
|
||||
checkDatabaseStructure(DatabaseUpdateType.INDEX);
|
||||
checkDatabaseStructure(DatabaseUpdateType.MOB_HEALTHBARS);
|
||||
checkDatabaseStructure(DatabaseUpdateType.PARTY_NAMES);
|
||||
checkDatabaseStructure(DatabaseUpdateType.KILL_ORPHANS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,6 +574,34 @@ public final class SQLDatabaseManager {
|
||||
write("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;");
|
||||
break;
|
||||
|
||||
case KILL_ORPHANS:
|
||||
mcMMO.p.getLogger().info("Killing orphans");
|
||||
write(
|
||||
"DELETE FROM " + tablePrefix + "experience " +
|
||||
"WHERE NOT EXISTS (SELECT * FROM " +
|
||||
tablePrefix + "users u WHERE " +
|
||||
tablePrefix + "experience.user_id = u.id);"
|
||||
);
|
||||
write(
|
||||
"DELETE FROM " + tablePrefix + "huds " +
|
||||
"WHERE NOT EXISTS (SELECT * FROM " +
|
||||
tablePrefix + "users u WHERE " +
|
||||
tablePrefix + "huds.user_id = u.id);"
|
||||
);
|
||||
write(
|
||||
"DELETE FROM " + tablePrefix + "cooldowns " +
|
||||
"WHERE NOT EXISTS (SELECT * FROM " +
|
||||
tablePrefix + "users u WHERE " +
|
||||
tablePrefix + "cooldowns.user_id = u.id);"
|
||||
);
|
||||
write(
|
||||
"DELETE FROM " + tablePrefix + "skills " +
|
||||
"WHERE NOT EXISTS (SELECT * FROM " +
|
||||
tablePrefix + "users u WHERE " +
|
||||
tablePrefix + "skills.user_id = u.id);"
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -6,4 +6,6 @@ public enum DatabaseUpdateType {
|
||||
INDEX,
|
||||
MOB_HEALTHBARS,
|
||||
PARTY_NAMES,
|
||||
KILL_ORPHANS,
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user