From 0559e99fb1e408bf8f165d9e9f0d0c3211aecbf1 Mon Sep 17 00:00:00 2001 From: Allink Date: Tue, 25 Jul 2023 18:56:06 +0100 Subject: [PATCH] Drop ptero_id column from admin table Fixes a SQLException thrown when adding admins to an older table schema version. --- .../java/me/totalfreedom/totalfreedommod/sql/SQLite.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java index d435537e..70b026ff 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/sql/SQLite.java @@ -90,6 +90,15 @@ public class SQLite extends FreedomService { FLog.severe("Failed to create the admins table: " + e.getMessage()); } + } else + { + try + { + connection.createStatement().execute("ALTER TABLE `admins` DROP COLUMN `ptero_id`"); + } catch (SQLException e) + { + // Ignore the error. If someone else wants to add WORKING AND TESTED CODE to check if the `ptero_id` column exists, they can, but I couldn't find a good way. + } } if (tableExists(meta, "players")) {