From df9b478be7e527ed2788a153dcdd8323ba8167d3 Mon Sep 17 00:00:00 2001 From: Intelli Date: Thu, 13 Jul 2023 13:56:27 -0600 Subject: [PATCH] Split up MySQL upgrade query to resolve issues from interrupted queries --- .../coreprotect/patch/script/__2_22_0.java | 68 ++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coreprotect/patch/script/__2_22_0.java b/src/main/java/net/coreprotect/patch/script/__2_22_0.java index d88b9e0..e7e2cf2 100644 --- a/src/main/java/net/coreprotect/patch/script/__2_22_0.java +++ b/src/main/java/net/coreprotect/patch/script/__2_22_0.java @@ -15,7 +15,73 @@ public class __2_22_0 { try { if (Config.getGlobal().MYSQL) { try { - statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN line_5 VARCHAR(100), ADD COLUMN line_6 VARCHAR(100), ADD COLUMN line_7 VARCHAR(100), ADD COLUMN line_8 VARCHAR(100), ADD COLUMN color_secondary INT, ADD COLUMN waxed TINYINT DEFAULT 0, ADD COLUMN face TINYINT DEFAULT 0;"); + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN line_5 VARCHAR(100);"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN line_6 VARCHAR(100);"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN line_7 VARCHAR(100);"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN line_8 VARCHAR(100);"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN color_secondary INT;"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN waxed TINYINT DEFAULT 0;"); + } + catch (Exception e) { + Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST)); + } + + if (!Patch.continuePatch()) { + return false; + } + + try { + statement.executeUpdate("ALTER TABLE " + ConfigHandler.prefix + "sign ADD COLUMN face TINYINT DEFAULT 0;"); } catch (Exception e) { Chat.console(Phrase.build(Phrase.PATCH_SKIP_UPDATE, ConfigHandler.prefix + "sign", Selector.FIRST, Selector.FIRST));