去除了不必要的数据库字段

This commit is contained in:
zhangyuheng 2024-05-20 10:50:56 +08:00
parent eccc437f18
commit c3192a1c81
5 changed files with 13 additions and 9 deletions

View File

@ -56,8 +56,7 @@ public class PlayerTitle extends Title {
private void save() {
String sql = "";
sql += "UPDATE mplt_player_title ";
sql += "SET expire_at = " + this._expire_at + ", ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "SET expire_at = " + this._expire_at + " ";
sql += "WHERE player_uuid = '" + _player_uuid.toString() + "' ";
sql += "AND title_id = " + this._id + ";";
MiniPlayerTitle.database.query(sql);

View File

@ -119,8 +119,7 @@ public class SaleTitle extends Title {
sql += "price = " + this._price + ", ";
sql += "days = " + this._days + ", ";
sql += "amount = " + this._amount + ", ";
sql += "sale_end_at = " + this._sale_end_at + ", ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "sale_end_at = " + this._sale_end_at + " ";
sql += "WHERE id = " + this._sale_id + ";";
MiniPlayerTitle.database.query(sql);

View File

@ -110,7 +110,6 @@ public class Title {
sql += "title = '" + this._title + "', ";
sql += "description = '" + this._description + "', ";
sql += "enabled = " + this._enabled + " ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "WHERE id = " + this._id + ";";
}
MiniPlayerTitle.database.query(sql);

View File

@ -55,8 +55,7 @@ public class XPlayer {
checkTitleValid();
String sql = "";
sql += "UPDATE mplt_player_info ";
sql += "SET using_title_id = " + _current_title_id + ", ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "SET using_title_id = " + _current_title_id + " ";
sql += "WHERE uuid = '" + _player.getUniqueId() + "';";
MiniPlayerTitle.database.query(sql);
updateName();
@ -87,8 +86,7 @@ public class XPlayer {
_coin = coin;
String sql = "";
sql += "UPDATE mplt_player_info ";
sql += "SET coin = " + coin + ", ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "SET coin = " + coin + " ";
sql += "WHERE uuid = '" + _player.getUniqueId().toString() + "';";
MiniPlayerTitle.database.query(sql);
}

View File

@ -72,5 +72,14 @@ public class DatabaseTables {
"CURRENT_TIMESTAMP " +
") ON CONFLICT (id) DO NOTHING;";
MiniPlayerTitle.database.query(sql);
MiniPlayerTitle.database.deleteColumnIfExists("mplt_title", "created_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_title", "updated_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_title_shop", "created_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_title_shop", "updated_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_player_info", "created_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_player_info", "updated_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_player_title", "created_at");
MiniPlayerTitle.database.deleteColumnIfExists("mplt_player_title", "updated_at");
}
}