mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 14:38:53 +00:00
Update database upgrade error message
Signed-off-by: BuildTools <[email protected]>
This commit is contained in:
1 parent
3c14856db6
commit
c89e97c36d
1 file changed
+3
-3
@@ -17,15 +17,15 @@ public class UpgradeDatabase {
|
|||||||
if (plugin.getConfig().getInt("config_file_version", 1) <= 5) {
|
if (plugin.getConfig().getInt("config_file_version", 1) <= 5) {
|
||||||
plugin.getLogger().info("Detected that the database needs updating. Running database upgrade...");
|
plugin.getLogger().info("Detected that the database needs updating. Running database upgrade...");
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||||
try (PreparedStatement statement = HuskHomes.getConnection().prepareStatement(
|
try (PreparedStatement tableUpdateStatement = HuskHomes.getConnection().prepareStatement(
|
||||||
"ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable()
|
"ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable()
|
||||||
+ " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0, "
|
+ " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0, "
|
||||||
+ "`offline_location_id` integer NULL DEFAULT NULL, "
|
+ "`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;")) {
|
+ "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!");
|
plugin.getLogger().info("Database update complete!");
|
||||||
} catch (SQLException e) {
|
} 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 {
|
} finally {
|
||||||
// Update the config file version
|
// Update the config file version
|
||||||
Bukkit.getScheduler().runTask(plugin, () -> {
|
Bukkit.getScheduler().runTask(plugin, () -> {
|
||||||
|
|||||||
Reference in new issue
Block a user