Fixes unable to create new DB when it doesnt exists.

This commit is contained in:
hondacrx
2023-01-23 04:10:54 -05:00
parent 6a11bac8ea
commit edcdfa95c4
3 changed files with 35 additions and 34 deletions
@@ -24,9 +24,6 @@ namespace Framework.Database
if (!result.IsEmpty() && !result.IsEmpty())
return true;
if (!DBUpdaterUtil.CheckExecutable())
return false;
Log.outInfo(LogFilter.SqlUpdates, $"Database {_database.GetDatabaseName()} is empty, auto populating it...");
string path = GetSourceDirectory();
@@ -71,9 +68,6 @@ namespace Framework.Database
public bool Update()
{
if (!DBUpdaterUtil.CheckExecutable())
return false;
Log.outInfo(LogFilter.SqlUpdates, $"Updating {_database.GetDatabaseName()} database...");
string sourceDirectory = GetSourceDirectory();
@@ -465,28 +459,4 @@ namespace Framework.Database
Apply,
Rehash
}
static class DBUpdaterUtil
{
static string mysqlExecutablePath;
public static string GetMySQLExecutable()
{
return mysqlExecutablePath;
}
public static bool CheckExecutable()
{
string mysqlExePath = ConfigMgr.GetDefaultValue("MySQLExecutable", "");
if (mysqlExePath.IsEmpty() || !File.Exists(mysqlExePath))
{
Log.outFatal(LogFilter.SqlUpdates, $"Didn't find any executable MySQL binary at \'{mysqlExePath}\' or in path, correct the path in the *.conf (\"MySQLExecutable\").");
return false;
}
// Correct the path to the cli
mysqlExecutablePath = mysqlExePath;
return true;
}
}
}