From 153e46653a2555721356878ffbe774eb427f480a Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Thu, 16 Jan 2020 17:40:44 +0800 Subject: [PATCH] Revert "fix loop message issue" This reverts commit 6eed16e0 Former-commit-id: 982a318d230d9603b4123fb208b659d49a9d272b --- .../quickshop/Database/DatabaseHelper.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/org/maxgamer/quickshop/Database/DatabaseHelper.java b/src/main/java/org/maxgamer/quickshop/Database/DatabaseHelper.java index 5e0562452..24c9ec9cb 100644 --- a/src/main/java/org/maxgamer/quickshop/Database/DatabaseHelper.java +++ b/src/main/java/org/maxgamer/quickshop/Database/DatabaseHelper.java @@ -76,6 +76,17 @@ public class DatabaseHelper { } catch (SQLException e) { //ignore } + if (QuickShop.instance.getDatabase().getCore() instanceof MySQLCore) { + try { + ps = db.getConnection().prepareStatement("ALTER TABLE " + QuickShop.instance + .getDbPrefix() + "messages MODIFY COLUMN message text CHARACTER SET utf8mb4 NOT NULL AFTER owner"); + ps.execute(); + ps.close(); + } catch (SQLException e) { + //ignore + } + } + } public void cleanMessage(long weekAgo) { @@ -113,6 +124,10 @@ public class DatabaseHelper { Statement st = db.getConnection().createStatement(); String createTable = "CREATE TABLE " + QuickShop.instance.getDbPrefix() + "messages (owner VARCHAR(255) NOT NULL, message TEXT(25) NOT NULL, time BIGINT(32) NOT NULL );"; + if (plugin.getDatabase().getCore() instanceof MySQLCore) { + createTable = "CREATE TABLE " + QuickShop.instance.getDbPrefix() + + "messages (owner VARCHAR(255) NOT NULL, message TEXT(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , time BIGINT(32) NOT NULL );"; + } return st.execute(createTable); }