mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-07 10:23:53 +00:00
[Character] Fix character copier due to schema change (#3805)
* [Character] Fix character copier due to schema change * Tweak
This commit is contained in:
parent
51cd43b4ea
commit
52763b6dd2
@ -2246,6 +2246,11 @@ bool Database::CopyCharacter(
|
||||
row = results.begin();
|
||||
std::string new_character_id = row[0];
|
||||
|
||||
std::vector<std::string> tables_to_zero_id = {
|
||||
"keyring",
|
||||
"data_buckets",
|
||||
};
|
||||
|
||||
TransactionBegin();
|
||||
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
|
||||
std::string table_name = iter.first;
|
||||
@ -2279,6 +2284,10 @@ bool Database::CopyCharacter(
|
||||
std::string column = columns[column_index];
|
||||
std::string value = row[column_index] ? row[column_index] : "null";
|
||||
|
||||
if (column == "id" && Strings::Contains(tables_to_zero_id, table_name)) {
|
||||
value = "0";
|
||||
}
|
||||
|
||||
if (column == character_id_column_name) {
|
||||
value = new_character_id;
|
||||
}
|
||||
@ -2326,7 +2335,6 @@ bool Database::CopyCharacter(
|
||||
if (!insert.ErrorMessage().empty()) {
|
||||
TransactionRollback();
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ namespace DatabaseSchema {
|
||||
{"character_tasks", "charid"},
|
||||
{"character_tribute", "character_id"},
|
||||
{"completed_tasks", "charid"},
|
||||
{"data_buckets", "id"},
|
||||
{"data_buckets", "character_id"},
|
||||
{"faction_values", "char_id"},
|
||||
{"friends", "charid"},
|
||||
{"guild_members", "char_id"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user