mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Fixes #329
This commit is contained in:
parent
a88b972a9a
commit
e617ae689f
@ -110,7 +110,7 @@ public abstract class SQLDB extends Database {
|
||||
|
||||
if (newDatabase) {
|
||||
Log.info("New Database created.");
|
||||
setVersion(10);
|
||||
setVersion(11);
|
||||
}
|
||||
|
||||
int version = getVersion();
|
||||
@ -128,6 +128,10 @@ public abstract class SQLDB extends Database {
|
||||
}
|
||||
}).runTaskLaterAsynchronously(TimeAmount.SECOND.ticks() * 5L);
|
||||
}
|
||||
if (version < 11) {
|
||||
serverTable.alterTableV11();
|
||||
setVersion(11);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new DatabaseInitException("Failed to set-up Database", e);
|
||||
}
|
||||
|
@ -65,12 +65,18 @@ public class ServerTable extends Table {
|
||||
.column(columnServerName, Sql.varchar(100))
|
||||
.column(columnWebserverAddress, Sql.varchar(100))
|
||||
.column(columnInstalled, Sql.BOOL).notNull().defaultValue(false)
|
||||
.column(columnMaxPlayers, Sql.BOOL).notNull().defaultValue("-1")
|
||||
.column(columnMaxPlayers, Sql.INT).notNull().defaultValue("-1")
|
||||
.primaryKey(usingMySQL, columnServerID)
|
||||
.toString()
|
||||
);
|
||||
}
|
||||
|
||||
public void alterTableV11() {
|
||||
if (usingMySQL) {
|
||||
executeUnsafe("ALTER TABLE " + tableName + " MODIFY " + columnMaxPlayers + " INTEGER NOT NULL DEFAULT -1");
|
||||
}
|
||||
}
|
||||
|
||||
public void saveCurrentServerInfo(ServerInfo info) throws SQLException {
|
||||
if (info.getId() == -1) {
|
||||
saveNewServerInfo(info);
|
||||
|
Loading…
Reference in New Issue
Block a user