mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-14 20:21:45 +01:00
ServerTable#createTableSQL, Deprecated ServerTable.Col
This commit is contained in:
parent
be6248de2f
commit
6b5f42aa3b
@ -17,6 +17,7 @@
|
|||||||
package com.djrapitops.plan.db.sql.tables;
|
package com.djrapitops.plan.db.sql.tables;
|
||||||
|
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
|
import com.djrapitops.plan.db.DBType;
|
||||||
import com.djrapitops.plan.db.SQLDB;
|
import com.djrapitops.plan.db.SQLDB;
|
||||||
import com.djrapitops.plan.db.access.ExecStatement;
|
import com.djrapitops.plan.db.access.ExecStatement;
|
||||||
import com.djrapitops.plan.db.access.QueryAllStatement;
|
import com.djrapitops.plan.db.access.QueryAllStatement;
|
||||||
@ -44,6 +45,13 @@ public class ServerTable extends Table {
|
|||||||
|
|
||||||
public static final String TABLE_NAME = "plan_servers";
|
public static final String TABLE_NAME = "plan_servers";
|
||||||
|
|
||||||
|
public static final String SERVER_ID = "id";
|
||||||
|
public static final String SERVER_UUID = "uuid";
|
||||||
|
public static final String NAME = "name";
|
||||||
|
public static final String WEB_ADDRESS = "web_address";
|
||||||
|
public static final String INSTALLED = "is_installed";
|
||||||
|
public static final String MAX_PLAYERS = "max_players";
|
||||||
|
|
||||||
public ServerTable(SQLDB db) {
|
public ServerTable(SQLDB db) {
|
||||||
super(TABLE_NAME, db);
|
super(TABLE_NAME, db);
|
||||||
statementSelectServerID = "(" + Select.from(tableName, tableName + "." + Col.SERVER_ID).where(tableName + "." + Col.SERVER_UUID + "=?").toString() + " LIMIT 1)";
|
statementSelectServerID = "(" + Select.from(tableName, tableName + "." + Col.SERVER_ID).where(tableName + "." + Col.SERVER_UUID + "=?").toString() + " LIMIT 1)";
|
||||||
@ -60,6 +68,17 @@ public class ServerTable extends Table {
|
|||||||
public final String statementSelectServerNameID;
|
public final String statementSelectServerNameID;
|
||||||
private String insertStatement;
|
private String insertStatement;
|
||||||
|
|
||||||
|
public static String createTableSQL(DBType dbType) {
|
||||||
|
return CreateTableParser.create(TABLE_NAME, dbType)
|
||||||
|
.column(SERVER_ID, Sql.INT).primaryKey()
|
||||||
|
.column(SERVER_UUID, Sql.varchar(36)).notNull().unique()
|
||||||
|
.column(NAME, Sql.varchar(100))
|
||||||
|
.column(WEB_ADDRESS, Sql.varchar(100))
|
||||||
|
.column(INSTALLED, Sql.BOOL).notNull().defaultValue(true)
|
||||||
|
.column(MAX_PLAYERS, Sql.INT).notNull().defaultValue("-1")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTable() throws DBInitException {
|
public void createTable() throws DBInitException {
|
||||||
createTable(TableSqlParser.createTable(tableName)
|
createTable(TableSqlParser.createTable(tableName)
|
||||||
@ -310,12 +329,19 @@ public class ServerTable extends Table {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public enum Col implements Column {
|
public enum Col implements Column {
|
||||||
|
@Deprecated
|
||||||
SERVER_ID("id"),
|
SERVER_ID("id"),
|
||||||
|
@Deprecated
|
||||||
SERVER_UUID("uuid"),
|
SERVER_UUID("uuid"),
|
||||||
|
@Deprecated
|
||||||
NAME("name"),
|
NAME("name"),
|
||||||
|
@Deprecated
|
||||||
WEBSERVER_ADDRESS("web_address"),
|
WEBSERVER_ADDRESS("web_address"),
|
||||||
|
@Deprecated
|
||||||
INSTALLED("is_installed"),
|
INSTALLED("is_installed"),
|
||||||
|
@Deprecated
|
||||||
MAX_PLAYERS("max_players");
|
MAX_PLAYERS("max_players");
|
||||||
|
|
||||||
private final String column;
|
private final String column;
|
||||||
|
Loading…
Reference in New Issue
Block a user