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

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() { private void save() {
String sql = ""; String sql = "";
sql += "UPDATE mplt_player_title "; sql += "UPDATE mplt_player_title ";
sql += "SET expire_at = " + this._expire_at + ", "; sql += "SET expire_at = " + this._expire_at + " ";
sql += "updated_at = CURRENT_TIMESTAMP ";
sql += "WHERE player_uuid = '" + _player_uuid.toString() + "' "; sql += "WHERE player_uuid = '" + _player_uuid.toString() + "' ";
sql += "AND title_id = " + this._id + ";"; sql += "AND title_id = " + this._id + ";";
MiniPlayerTitle.database.query(sql); MiniPlayerTitle.database.query(sql);

View File

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

View File

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

View File

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

View File

@ -72,5 +72,14 @@ public class DatabaseTables {
"CURRENT_TIMESTAMP " + "CURRENT_TIMESTAMP " +
") ON CONFLICT (id) DO NOTHING;"; ") ON CONFLICT (id) DO NOTHING;";
MiniPlayerTitle.database.query(sql); 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");
} }
} }