diff --git a/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java b/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java index 9439d4b..1723e36 100644 --- a/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java @@ -79,12 +79,17 @@ public class DatabaseDataStore extends DataStore statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_nextclaimid (nextid INT(15));"); - statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_claimdata (id INT(15), owner VARCHAR(50), lessercorner VARCHAR(100), greatercorner VARCHAR(100), builders VARCHAR(1000), containers VARCHAR(1000), accessors VARCHAR(1000), managers VARCHAR(1000), parentid INT(15));"); + statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_claimdata (id INT(15), owner VARCHAR(50), lessercorner VARCHAR(100), greatercorner VARCHAR(100), builders VARCHAR(65000), containers VARCHAR(65000), accessors VARCHAR(65000), managers VARCHAR(65000), parentid INT(15));"); statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_playerdata (name VARCHAR(50), lastlogin DATETIME, accruedblocks INT(15), bonusblocks INT(15));"); statement.execute("CREATE TABLE IF NOT EXISTS griefprevention_schemaversion (version INT(15));"); + statement.execute("ALTER TABLE griefprevention_claimdata MODIFY builders VARCHAR(65000);"); + statement.execute("ALTER TABLE griefprevention_claimdata MODIFY containers VARCHAR(65000);"); + statement.execute("ALTER TABLE griefprevention_claimdata MODIFY accessors VARCHAR(65000);"); + statement.execute("ALTER TABLE griefprevention_claimdata MODIFY managers VARCHAR(65000);"); + //if the next claim id table is empty, this is a brand new database which will write using the latest schema //otherwise, schema version is determined by schemaversion table (or =0 if table is empty, see getSchemaVersion()) ResultSet results = statement.executeQuery("SELECT * FROM griefprevention_nextclaimid;"); @@ -615,7 +620,12 @@ public class DatabaseDataStore extends DataStore { if(this.databaseConnection == null || !this.databaseConnection.isValid(3)) { - //set username/pass properties + if(this.databaseConnection != null && !this.databaseConnection.isClosed()) + { + this.databaseConnection.close(); + } + + //set username/pass properties Properties connectionProps = new Properties(); connectionProps.put("user", this.userName); connectionProps.put("password", this.password);