mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-11 19:32:24 +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();
|
row = results.begin();
|
||||||
std::string new_character_id = row[0];
|
std::string new_character_id = row[0];
|
||||||
|
|
||||||
|
std::vector<std::string> tables_to_zero_id = {
|
||||||
|
"keyring",
|
||||||
|
"data_buckets",
|
||||||
|
};
|
||||||
|
|
||||||
TransactionBegin();
|
TransactionBegin();
|
||||||
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
|
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
|
||||||
std::string table_name = iter.first;
|
std::string table_name = iter.first;
|
||||||
@ -2279,6 +2284,10 @@ bool Database::CopyCharacter(
|
|||||||
std::string column = columns[column_index];
|
std::string column = columns[column_index];
|
||||||
std::string value = row[column_index] ? row[column_index] : "null";
|
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) {
|
if (column == character_id_column_name) {
|
||||||
value = new_character_id;
|
value = new_character_id;
|
||||||
}
|
}
|
||||||
@ -2326,7 +2335,6 @@ bool Database::CopyCharacter(
|
|||||||
if (!insert.ErrorMessage().empty()) {
|
if (!insert.ErrorMessage().empty()) {
|
||||||
TransactionRollback();
|
TransactionRollback();
|
||||||
return false;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace DatabaseSchema {
|
|||||||
{"character_tasks", "charid"},
|
{"character_tasks", "charid"},
|
||||||
{"character_tribute", "character_id"},
|
{"character_tribute", "character_id"},
|
||||||
{"completed_tasks", "charid"},
|
{"completed_tasks", "charid"},
|
||||||
{"data_buckets", "id"},
|
{"data_buckets", "character_id"},
|
||||||
{"faction_values", "char_id"},
|
{"faction_values", "char_id"},
|
||||||
{"friends", "charid"},
|
{"friends", "charid"},
|
||||||
{"guild_members", "char_id"},
|
{"guild_members", "char_id"},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user