Start work on tpOffline, add database column & modify upgrade script for 2.7

Signed-off-by: BuildTools <[email protected]>
This commit is contained in:
BuildTools committed 2021-07-12 19:04:38 +03:00
1 parent 6ee2b2ce4d
commit 8b104a04cd
7 files changed
+101 -11

No files matched your search

@@ -17,7 +17,11 @@ 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("ALTER TABLE " + HuskHomes.getSettings().getPlayerDataTable() + " ADD `is_ignoring_requests` boolean NOT NULL DEFAULT 0")) {
try (PreparedStatement statement = 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();
plugin.getLogger().info("Database update complete!");
} catch (SQLException e) {