mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Core/DBUpdater): Fix sql files not being applied in alphabetic order (#24206)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
std::string DBUpdaterUtil::GetCorrectedMySQLExecutable()
|
||||
{
|
||||
@@ -396,16 +397,23 @@ bool DBUpdater<T>::Populate(DatabaseWorkerPool<T>& pool)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::filesystem::directory_iterator itr(DirPath); itr != DirItr; ++itr)
|
||||
{
|
||||
if (itr->path().extension() != ".sql")
|
||||
continue;
|
||||
std::vector<std::filesystem::path> sqlFiles;
|
||||
|
||||
LOG_INFO("sql.updates", ">> Applying \'{}\'...", itr->path().filename().generic_string());
|
||||
for (const auto &entry : std::filesystem::directory_iterator(DirPath))
|
||||
{
|
||||
if (entry.path().extension() == ".sql")
|
||||
sqlFiles.push_back(entry.path());
|
||||
}
|
||||
|
||||
std::sort(sqlFiles.begin(), sqlFiles.end());
|
||||
|
||||
for (const auto &file : sqlFiles)
|
||||
{
|
||||
LOG_INFO("sql.updates", ">> Applying \'{}\'...", file.filename().generic_string());
|
||||
|
||||
try
|
||||
{
|
||||
ApplyFile(pool, itr->path());
|
||||
ApplyFile(pool, file);
|
||||
}
|
||||
catch (UpdateException&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user