mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-02 10:00:23 +02:00
UsersTable#createTableSQL, Deprecated UsersTable.Col
This commit is contained in:
parent
6b5f42aa3b
commit
37f5ecd9f8
|
@ -21,6 +21,7 @@ import com.djrapitops.plan.data.container.UserInfo;
|
||||||
import com.djrapitops.plan.data.store.Key;
|
import com.djrapitops.plan.data.store.Key;
|
||||||
import com.djrapitops.plan.data.store.containers.DataContainer;
|
import com.djrapitops.plan.data.store.containers.DataContainer;
|
||||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||||
|
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;
|
||||||
|
@ -46,6 +47,12 @@ public class UsersTable extends UserUUIDTable {
|
||||||
|
|
||||||
public static final String TABLE_NAME = "plan_users";
|
public static final String TABLE_NAME = "plan_users";
|
||||||
|
|
||||||
|
public static final String ID = "id";
|
||||||
|
public static final String USER_UUID = "uuid";
|
||||||
|
public static final String REGISTERED = "registered";
|
||||||
|
public static final String USER_NAME = "name";
|
||||||
|
public static final String TIMES_KICKED = "times_kicked";
|
||||||
|
|
||||||
public UsersTable(SQLDB db) {
|
public UsersTable(SQLDB db) {
|
||||||
super(TABLE_NAME, db);
|
super(TABLE_NAME, db);
|
||||||
statementSelectID = "(" + Select.from(tableName, tableName + "." + Col.ID).where(Col.UUID + "=?").toString() + " LIMIT 1)";
|
statementSelectID = "(" + Select.from(tableName, tableName + "." + Col.ID).where(Col.UUID + "=?").toString() + " LIMIT 1)";
|
||||||
|
@ -58,6 +65,16 @@ public class UsersTable extends UserUUIDTable {
|
||||||
public final String statementSelectID;
|
public final String statementSelectID;
|
||||||
private String insertStatement;
|
private String insertStatement;
|
||||||
|
|
||||||
|
public static String createTableSQL(DBType dbType) {
|
||||||
|
return CreateTableParser.create(TABLE_NAME, dbType)
|
||||||
|
.column(ID, Sql.INT).primaryKey()
|
||||||
|
.column(USER_UUID, Sql.varchar(36)).notNull().unique()
|
||||||
|
.column(REGISTERED, Sql.LONG).notNull()
|
||||||
|
.column(USER_NAME, Sql.varchar(16)).notNull()
|
||||||
|
.column(TIMES_KICKED, Sql.INT).notNull().defaultValue("0")
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTable() throws DBInitException {
|
public void createTable() throws DBInitException {
|
||||||
createTable(TableSqlParser.createTable(tableName)
|
createTable(TableSqlParser.createTable(tableName)
|
||||||
|
@ -426,11 +443,17 @@ public class UsersTable extends UserUUIDTable {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public enum Col implements Column {
|
public enum Col implements Column {
|
||||||
|
@Deprecated
|
||||||
ID("id"),
|
ID("id"),
|
||||||
|
@Deprecated
|
||||||
UUID("uuid"),
|
UUID("uuid"),
|
||||||
|
@Deprecated
|
||||||
REGISTERED("registered"),
|
REGISTERED("registered"),
|
||||||
|
@Deprecated
|
||||||
USER_NAME("name"),
|
USER_NAME("name"),
|
||||||
|
@Deprecated
|
||||||
TIMES_KICKED("times_kicked");
|
TIMES_KICKED("times_kicked");
|
||||||
|
|
||||||
private final String column;
|
private final String column;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user