This commit is contained in:
Rsl1122 2017-10-04 18:16:07 +03:00
parent a88b972a9a
commit e617ae689f
2 changed files with 12 additions and 2 deletions

View File

@ -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);
}

View File

@ -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);