mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 00:46:46 +00:00
[Database] Implement native database migrations in server (#2857)
* [Database] Implement native database updates in server * Cleanup * Delete db_update_manifest.txt * Bots updates * Final tweaks * Revert manifest * Tweaks * Remove code from eqemu_server.pl * Update database_update.cpp * Add user prompt update skipping with timeouts * Add termcolor IS_TTY is check * Update database_conversions.cpp * Remove large migrations * Push * fix headers. * Remove last of non-bot large migrations * Update database_update_manifest.cpp * More purging * Tweaks * Bot migrations * More work * Tweaks * Implement multi-statement query execution only for migrations * Add CLI database:updates * Add bootstrap commands * Upload bootstrap sql's * Update bot_tables_bootstrap.sql * Update bot_tables_bootstrap.sql * Add mercs:bootstrap and bots:bootstrap * Update bot_tables_bootstrap.sql * Update database.cpp * Update bot_tables_bootstrap.sql * More cleanup * Add mercs:disable and bots:disable * Update eqemu_server.pl * Update eqemu_server.pl * Update eqemu_server.pl * Test cases * Update eqemu_server.pl * Delete 2023_05_08_character_tribute_primary_key.sql * Post rebase fixes * Post rebase tweaks * Delete errant files * Rebase files from master * More adjustments * Delete files no longer used * Add missing migrations * bots:bootstrap is now bots:enable --------- Co-authored-by: Aeadoin <109764533+Aeadoin@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
#include "../../common/database/database_update.h"
|
||||
|
||||
void WorldserverCLI::DatabaseUpdates(int argc, char **argv, argh::parser &cmd, std::string &description)
|
||||
{
|
||||
description = "Runs database updates manually";
|
||||
|
||||
if (cmd[{"-h", "--help"}]) {
|
||||
return;
|
||||
}
|
||||
|
||||
DatabaseUpdate update;
|
||||
update.SetDatabase(&database)->CheckDbUpdates();
|
||||
}
|
||||
+2
-13
@@ -283,18 +283,6 @@ extern WorldEventScheduler event_scheduler;
|
||||
|
||||
bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
{
|
||||
// ignore
|
||||
bool ignore_db = false;
|
||||
if (argc >= 2) {
|
||||
if (strcasecmp(argv[1], "ignore_db") == 0) {
|
||||
ignore_db = true;
|
||||
}
|
||||
else {
|
||||
std::cerr << "Error, unknown command line option" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// logging system init
|
||||
auto logging = LogSys.SetDatabase(&database)
|
||||
->SetLogPath(path.GetLogPath())
|
||||
@@ -302,7 +290,8 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
|
||||
LogSys.SetDiscordHandler(&WorldBoot::DiscordWebhookMessageHandler);
|
||||
|
||||
if (!ignore_db) {
|
||||
const auto c = EQEmuConfig::get();
|
||||
if (c->auto_database_updates) {
|
||||
LogInfo("Checking Database Conversions");
|
||||
database.CheckDatabaseConversions();
|
||||
}
|
||||
|
||||
@@ -12,14 +12,10 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
||||
cmd.parse(argc, argv, argh::parser::PREFER_PARAM_FOR_UNREG_OPTION);
|
||||
EQEmuCommand::DisplayDebug(cmd);
|
||||
|
||||
/**
|
||||
* Declare command mapping
|
||||
*/
|
||||
// Declare command mapping
|
||||
auto function_map = EQEmuCommand::function_map;
|
||||
|
||||
/**
|
||||
* Register commands
|
||||
*/
|
||||
// Register commands
|
||||
function_map["bots:enable"] = &WorldserverCLI::BotsEnable;
|
||||
function_map["bots:disable"] = &WorldserverCLI::BotsDisable;
|
||||
function_map["mercs:enable"] = &WorldserverCLI::MercsEnable;
|
||||
@@ -30,6 +26,7 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
||||
function_map["database:set-account-status"] = &WorldserverCLI::DatabaseSetAccountStatus;
|
||||
function_map["database:schema"] = &WorldserverCLI::DatabaseGetSchema;
|
||||
function_map["database:dump"] = &WorldserverCLI::DatabaseDump;
|
||||
function_map["database:updates"] = &WorldserverCLI::DatabaseUpdates;
|
||||
function_map["test:test"] = &WorldserverCLI::TestCommand;
|
||||
function_map["test:colors"] = &WorldserverCLI::TestColors;
|
||||
function_map["test:expansion"] = &WorldserverCLI::ExpansionTestCommand;
|
||||
@@ -41,12 +38,13 @@ void WorldserverCLI::CommandHandler(int argc, char **argv)
|
||||
EQEmuCommand::HandleMenu(function_map, cmd, argc, argv);
|
||||
}
|
||||
|
||||
#include "cli/database_concurrency.cpp"
|
||||
#include "cli/bots_enable.cpp"
|
||||
#include "cli/bots_disable.cpp"
|
||||
#include "cli/mercs_enable.cpp"
|
||||
#include "cli/mercs_disable.cpp"
|
||||
#include "cli/database_concurrency.cpp"
|
||||
#include "cli/copy_character.cpp"
|
||||
#include "cli/database_updates.cpp"
|
||||
#include "cli/database_dump.cpp"
|
||||
#include "cli/database_get_schema.cpp"
|
||||
#include "cli/database_set_account_status.cpp"
|
||||
|
||||
@@ -17,6 +17,7 @@ public:
|
||||
static void DatabaseSetAccountStatus(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void DatabaseGetSchema(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void DatabaseDump(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void DatabaseUpdates(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void TestColors(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
static void ExpansionTestCommand(int argc, char **argv, argh::parser &cmd, std::string &description);
|
||||
|
||||
Reference in New Issue
Block a user