diff --git a/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java b/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java index 13f6a9ce..eb84465d 100644 --- a/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java +++ b/src/main/java/me/william278/huskhomes2/migrators/UpgradeDatabase.java @@ -17,15 +17,15 @@ public class UpgradeDatabase { if (plugin.getConfig().getInt("config_file_version", 1) <= 5) { plugin.getLogger().info("Detected that the database needs updating. Running database upgrade..."); Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> { - try (PreparedStatement statement = HuskHomes.getConnection().prepareStatement( + try (PreparedStatement tableUpdateStatement = HuskHomes.getConnection().prepareStatement( "ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() + " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0, " + "`offline_location_id` integer NULL DEFAULT NULL, " + "FOREIGN KEY (`offline_location_id`) REFERENCES " + HuskHomes.getSettings().getLocationsDataTable() + " (`location_id`) ON DELETE SET NULL ON UPDATE NO ACTION;")) { - statement.executeUpdate(); + tableUpdateStatement.executeUpdate(); plugin.getLogger().info("Database update complete!"); } catch (SQLException e) { - plugin.getLogger().log(Level.SEVERE, "An SQL exception occurred upgrading the database format!", e); + plugin.getLogger().warning("Failed to perform the database upgrade: " + e.getCause() + ". This might be because another server on your HuskHomes network already carried out the upgrade - in which case you can safely ignore this warning."); } finally { // Update the config file version Bukkit.getScheduler().runTask(plugin, () -> {