Skip to content
This repository was archived by the owner on Dec 5, 2021. It is now read-only.

Commit 2c9e42c

Browse files
remove Default Constraint and handle old shop
Former-commit-id: 150fdc5
1 parent dfd306f commit 2c9e42c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/main/java/org/maxgamer/quickshop/database/DatabaseHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ private void checkColumns() {
114114
// Reremake - DataStorage @TODO needs testing
115115
if (plugin.getDatabase().getCore() instanceof MySQLCore) {
116116
ps = db.getConnection().prepareStatement("ALTER TABLE " + plugin
117-
.getDbPrefix() + "shops ADD extra LONGTEXT NOT NULL DEFAULT '{}'");
117+
.getDbPrefix() + "shops ADD extra LONGTEXT NOT NULL");
118118
} else {
119119
ps = db.getConnection().prepareStatement("ALTER TABLE " + plugin
120-
.getDbPrefix() + "shops ADD COLUMN extra TEXT NOT NULL DEFAULT '{}'");
120+
.getDbPrefix() + "shops ADD COLUMN extra TEXT NOT NULL");
121121
}
122122
Util.debugLog("Setting up the column EXTRA...");
123123
ps.execute();

src/main/java/org/maxgamer/quickshop/shop/ShopLoader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@ public class ShopDatabaseInfoOrigin {
425425
this.type = rs.getInt("type");
426426
this.unlimited = rs.getBoolean("unlimited");
427427
this.extra = rs.getString("extra");
428+
//handle old shops
429+
if (extra == null) {
430+
extra = "{}";
431+
}
428432
} catch (SQLException sqlex) {
429433
exceptionHandler(sqlex, null);
430434
}

0 commit comments

Comments
 (0)