mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-01 20:32:26 +00:00
Address PR review: check transaction/delete results, fix manifest, use distinct spell IDs in test
Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>
This commit is contained in:
parent
4f4742b425
commit
d0e1c027e9
@ -7192,14 +7192,15 @@ ALTER TABLE `character_parcels_containers`
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9329,
|
||||
.description = "2025_06_27_add_suppressed_to_character_buffs.sql",
|
||||
.description = "2026_03_08_add_suppressed_to_character_buffs.sql",
|
||||
.check = "SHOW COLUMNS FROM `character_buffs` LIKE 'suppressed'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `character_buffs`
|
||||
ADD COLUMN `suppressed` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `instrument_mod`;
|
||||
)"
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
|
||||
@ -828,9 +828,9 @@ inline void TestHpManaEnd()
|
||||
|
||||
inline void TestClientBuffPersistence()
|
||||
{
|
||||
constexpr uint32 test_character_id = 99999991;
|
||||
constexpr uint16 normal_spell_id = 6824;
|
||||
constexpr uint16 suppressed_spell_id = 6824;
|
||||
constexpr uint32 test_character_id = 99999991;
|
||||
constexpr uint16 normal_spell_id = 6824;
|
||||
constexpr uint16 suppressed_spell_id = 2550;
|
||||
|
||||
auto schema_check = database.QueryDatabase("SHOW COLUMNS FROM `character_buffs` LIKE 'suppressed'");
|
||||
RunTest(
|
||||
|
||||
@ -2925,15 +2925,33 @@ void ZoneDatabase::SaveBuffs(Client *client)
|
||||
v.emplace_back(e);
|
||||
}
|
||||
|
||||
database.TransactionBegin();
|
||||
const auto begin_result = database.QueryDatabase("START TRANSACTION");
|
||||
if (!begin_result.Success()) {
|
||||
LogError(
|
||||
"Failed to begin buff save transaction for character [{}] [{}]: {}",
|
||||
client->GetCleanName(),
|
||||
client->CharacterID(),
|
||||
begin_result.ErrorMessage()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
CharacterBuffsRepository::DeleteWhere(
|
||||
database,
|
||||
const auto delete_result = database.QueryDatabase(
|
||||
fmt::format(
|
||||
"`character_id` = {}",
|
||||
"DELETE FROM `character_buffs` WHERE `character_id` = {}",
|
||||
client->CharacterID()
|
||||
)
|
||||
);
|
||||
if (!delete_result.Success()) {
|
||||
database.TransactionRollback();
|
||||
LogError(
|
||||
"Failed to delete existing buffs for character [{}] [{}]: {}",
|
||||
client->GetCleanName(),
|
||||
client->CharacterID(),
|
||||
delete_result.ErrorMessage()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!v.empty()) {
|
||||
const auto saved_count = CharacterBuffsRepository::ReplaceMany(database, v);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user