#702: MySQL error in upgrader

This commit is contained in:
md_5
2017-08-16 20:52:28 +10:00
parent a51651c306
commit 40c1cc1c22

View File

@@ -388,16 +388,18 @@ class Updater {
if (configVersion.compareTo(new ComparableVersion("1.12.0")) < 0) { if (configVersion.compareTo(new ComparableVersion("1.12.0")) < 0) {
getLogger().info("Updating tables to 1.12.0 ..."); getLogger().info("Updating tables to 1.12.0 ...");
final Connection conn = logblock.getConnection(); if (isLogging(Logging.CHAT)) {
try { final Connection conn = logblock.getConnection();
conn.setAutoCommit(true); try {
final Statement st = conn.createStatement(); conn.setAutoCommit(true);
st.execute("ALTER TABLE `lb-chat` ALTER COLUMN `message` VARCHAR(256) NOT NULL"); final Statement st = conn.createStatement();
st.close(); st.execute("ALTER TABLE `lb-chat` MODIFY COLUMN `message` VARCHAR(256) NOT NULL");
conn.close(); st.close();
} catch (final SQLException ex) { conn.close();
Bukkit.getLogger().log(Level.SEVERE, "[Updater] Error: ", ex); } catch (final SQLException ex) {
return false; Bukkit.getLogger().log(Level.SEVERE, "[Updater] Error: ", ex);
return false;
}
} }
config.set("version", "1.12.0"); config.set("version", "1.12.0");
} }