Skip to content

Commit

Permalink
Update database upgrade error message
Browse files Browse the repository at this point in the history
Signed-off-by: BuildTools <[email protected]>
  • Loading branch information
BuildTools committed Jul 15, 2021
1 parent 3c14856 commit c89e97c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public static void 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, () -> {
Expand Down

0 comments on commit c89e97c

Please sign in to comment.