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