mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-10 00:53:51 +00:00
[Database Backup] Enable database dump of bot data (#2221)
* Add option to dump bot data * Add player_bot_table dump suppor to command handler * Add tableList getter to the dump_service * Fix declaration in header file * Include missed bot tables * Rename player-bot to bot to be more descriptive * Fix missed reference to player-bots Co-authored-by: Kieren Hinch <khinch-github@nylonmoon.com>
This commit is contained in:
parent
30e34c67b4
commit
86c9be410d
@ -163,6 +163,20 @@ std::string DatabaseDumpService::GetPlayerTablesList()
|
||||
return trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetBotTablesList()
|
||||
{
|
||||
std::string tables_list;
|
||||
std::vector<std::string> tables = DatabaseSchema::GetBotTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@ -317,6 +331,11 @@ void DatabaseDumpService::Dump()
|
||||
tables_to_dump += GetPlayerTablesList() + " ";
|
||||
dump_descriptor += "-player";
|
||||
}
|
||||
|
||||
if (IsDumpBotTables()) {
|
||||
tables_to_dump += GetBotTablesList() + " ";
|
||||
dump_descriptor += "-bots";
|
||||
}
|
||||
|
||||
if (IsDumpSystemTables()) {
|
||||
tables_to_dump += GetSystemTablesList() + " ";
|
||||
@ -436,6 +455,7 @@ void DatabaseDumpService::Dump()
|
||||
// LogDebug("[{}] login", (IsDumpLoginServerTables() ? "true" : "false"));
|
||||
// LogDebug("[{}] player", (IsDumpPlayerTables() ? "true" : "false"));
|
||||
// LogDebug("[{}] system", (IsDumpSystemTables() ? "true" : "false"));
|
||||
// LogDebug("[{}] bot", (IsDumpBotTables() ? "true" : "false"));
|
||||
}
|
||||
|
||||
bool DatabaseDumpService::IsDumpSystemTables() const
|
||||
@ -577,3 +597,13 @@ void DatabaseDumpService::SetDumpStateTables(bool dump_state_tables)
|
||||
{
|
||||
DatabaseDumpService::dump_state_tables = dump_state_tables;
|
||||
}
|
||||
|
||||
bool DatabaseDumpService::IsDumpBotTables() const
|
||||
{
|
||||
return dump_bot_tables;
|
||||
}
|
||||
|
||||
void DatabaseDumpService::SetDumpBotTables(bool dump_bot_tables)
|
||||
{
|
||||
DatabaseDumpService::dump_bot_tables = dump_bot_tables;
|
||||
}
|
||||
|
||||
@ -53,6 +53,8 @@ public:
|
||||
void SetDumpDropTableSyntaxOnly(bool dump_drop_table_syntax_only);
|
||||
bool IsDumpStateTables() const;
|
||||
void SetDumpStateTables(bool dump_state_tables);
|
||||
bool IsDumpBotTables() const;
|
||||
void SetDumpBotTables(bool dump_bot_tables);
|
||||
|
||||
private:
|
||||
bool dump_all_tables = false;
|
||||
@ -67,6 +69,7 @@ private:
|
||||
bool dump_with_compression = false;
|
||||
bool dump_output_to_console = false;
|
||||
bool dump_drop_table_syntax_only = false;
|
||||
bool dump_bot_tables = false;
|
||||
std::string dump_path;
|
||||
std::string dump_file_name;
|
||||
|
||||
@ -75,6 +78,7 @@ private:
|
||||
std::string GetMySQLVersion();
|
||||
std::string GetBaseMySQLDumpCommand();
|
||||
std::string GetPlayerTablesList();
|
||||
std::string GetBotTablesList();
|
||||
std::string GetSystemTablesList();
|
||||
std::string GetStateTablesList();
|
||||
std::string GetContentTablesList();
|
||||
|
||||
@ -375,6 +375,40 @@ namespace DatabaseSchema {
|
||||
"inventory_versions",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Gets all player bot tables
|
||||
* @note These tables have no content in the PEQ daily dump
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
static std::vector<std::string> GetBotTables()
|
||||
{
|
||||
return {
|
||||
"bot_buffs",
|
||||
"bot_command_settings",
|
||||
"bot_create_combinations",
|
||||
"bot_data",
|
||||
"bot_group_members",
|
||||
"bot_groups",
|
||||
"bot_guild_members",
|
||||
"bot_heal_rotation_members",
|
||||
"bot_heal_rotation_targets",
|
||||
"bot_heal_rotations",
|
||||
"bot_inspect_messages",
|
||||
"bot_inventories",
|
||||
"bot_owner_options",
|
||||
"bot_pet_buffs",
|
||||
"bot_pet_inventories",
|
||||
"bot_pets",
|
||||
"bot_spell_casting_chances",
|
||||
"bot_spells_entries",
|
||||
"bot_stances",
|
||||
"bot_timers",
|
||||
"vw_bot_character_mobs",
|
||||
"vw_bot_groups"
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -198,6 +198,12 @@ namespace WorldserverCommandHandler {
|
||||
for (const auto &table: version_tables) {
|
||||
version_tables_json.append(table);
|
||||
}
|
||||
|
||||
Json::Value bot_tables_json;
|
||||
std::vector<std::string> bot_tables = DatabaseSchema::GetBotTables();
|
||||
for (const auto &table: bot_tables) {
|
||||
bot_tables_json.append(table);
|
||||
}
|
||||
|
||||
Json::Value schema;
|
||||
|
||||
@ -207,6 +213,7 @@ namespace WorldserverCommandHandler {
|
||||
schema["server_tables"] = server_tables_json;
|
||||
schema["state_tables"] = state_tables_json;
|
||||
schema["version_tables"] = version_tables_json;
|
||||
schema["bot_tables"] = bot_tables_json;
|
||||
|
||||
std::stringstream payload;
|
||||
payload << schema;
|
||||
@ -230,6 +237,7 @@ namespace WorldserverCommandHandler {
|
||||
"--content-tables",
|
||||
"--login-tables",
|
||||
"--player-tables",
|
||||
"--bot-tables",
|
||||
"--state-tables",
|
||||
"--system-tables",
|
||||
"--query-serv-tables",
|
||||
@ -260,6 +268,7 @@ namespace WorldserverCommandHandler {
|
||||
database_dump_service->SetDumpContentTables(cmd[{"--content-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpLoginServerTables(cmd[{"--login-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpPlayerTables(cmd[{"--player-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpBotTables(cmd[{"--bot-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpStateTables(cmd[{"--state-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpSystemTables(cmd[{"--system-tables"}] || dump_all);
|
||||
database_dump_service->SetDumpQueryServerTables(cmd[{"--query-serv-tables"}] || dump_all);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user