新建了部分数据库表
This commit is contained in:
parent
87d0436821
commit
e051167757
@ -23,6 +23,7 @@ public final class EssentialsD extends JavaPlugin {
|
||||
instance = this;
|
||||
config = new ConfigManager(instance);
|
||||
dbConnection = DatabaseManager.createConnection();
|
||||
DatabaseManager.migrate();
|
||||
scheduler = new Scheduler(this);
|
||||
tpManager = new TeleportManager();
|
||||
|
||||
|
@ -89,5 +89,72 @@ public class DatabaseManager {
|
||||
|
||||
public static void migrate() {
|
||||
String sql = "";
|
||||
|
||||
// player name
|
||||
sql = "CREATE TABLE IF NOT EXISTS player_name (" +
|
||||
" uuid VARCHAR(36) NOT NULL UNIQUE PRIMARY KEY," +
|
||||
" last_known_name TEXT NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// login record
|
||||
sql = "CREATE TABLE IF NOT EXISTS login_record (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" uuid VARCHAR(36) NOT NULL," +
|
||||
" ip VARCHAR(15) NOT NULL," +
|
||||
" name TEXT NOT NULL," +
|
||||
" login_time TIMESTAMP NOT NULL," +
|
||||
" logout_location TEXT," +
|
||||
" logout_time TIMESTAMP" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// name record
|
||||
sql = "CREATE TABLE IF NOT EXISTS name_record (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" uuid VARCHAR(36) NOT NULL," +
|
||||
" name TEXT NOT NULL," +
|
||||
" time TIMESTAMP NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// tp record
|
||||
sql = "CREATE TABLE IF NOT EXISTS tp_record (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" initiator_uuid VARCHAR(36) NOT NULL," +
|
||||
" from_location TEXT NOT NULL," +
|
||||
" to_location TEXT NOT NULL," +
|
||||
" type TEXT NOT NULL," +
|
||||
" success BOOLEAN NOT NULL," +
|
||||
" time TIMESTAMP NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// message record
|
||||
sql = "CREATE TABLE IF NOT EXISTS message_record (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" sender_uuid VARCHAR(36) NOT NULL," +
|
||||
" message TEXT NOT NULL," +
|
||||
" time TIMESTAMP NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// command record
|
||||
sql = "CREATE TABLE IF NOT EXISTS command_record (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" executor_uuid VARCHAR(36) NOT NULL," +
|
||||
" command TEXT NOT NULL," +
|
||||
" time TIMESTAMP NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
|
||||
// home info
|
||||
sql = "CREATE TABLE IF NOT EXISTS home_info (" +
|
||||
" id SERIAL PRIMARY KEY," +
|
||||
" uuid VARCHAR(36) NOT NULL," +
|
||||
" home_name TEXT NOT NULL," +
|
||||
" location TEXT NOT NULL" +
|
||||
");";
|
||||
query(sql);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user