mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
Remove complex migration
Only shooting gallery had a value put in the wrong column. All others were either already correct or unimplemented.
This commit is contained in:
parent
fcb088d263
commit
42870028e4
@ -9,6 +9,7 @@
|
||||
#include "BinaryPathFinder.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "LeaderboardManager.h"
|
||||
|
||||
#include <istream>
|
||||
|
||||
@ -58,8 +59,6 @@ void MigrationRunner::RunMigrations() {
|
||||
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
|
||||
if (migration.name == "dlu/5_brick_model_sd0.sql") {
|
||||
runSd0Migrations = true;
|
||||
} else if (migration.name == "dlu/10_Update_Leaderboard_Columns.sql") {
|
||||
continue;
|
||||
} else {
|
||||
finalSQL.append(migration.data.c_str());
|
||||
}
|
||||
@ -160,23 +159,3 @@ void MigrationRunner::RunSQLiteMigrations() {
|
||||
|
||||
Game::logger->Log("MigrationRunner", "CDServer database is up to date.");
|
||||
}
|
||||
|
||||
void MigrationRunner::MigrateLeaderboard() {
|
||||
Game::logger->Log("MigrationRunner", "Checking if leaderboard migration needs to be run...");
|
||||
{
|
||||
std::unique_ptr<sql::PreparedStatement> stmt(Database::CreatePreppedStmt("SELECT * FROM migration_history WHERE name = ?;"));
|
||||
stmt->setString(1, "dlu/10_Update_Leaderboard_Columns.sql");
|
||||
std::unique_ptr<sql::ResultSet> res(stmt->executeQuery());
|
||||
if (res->next()) {
|
||||
Game::logger->Log("MigrationRunner", "Leaderboard migration has already been run.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||
auto leaderboards = activitiesTable->Query([=](const CDActivities& entry) {
|
||||
return entry.leaderboardType != -1;
|
||||
});
|
||||
for (auto entry : leaderboards) {
|
||||
Game::logger->Log("MigrationRunner", "Got leaderboard type %i for activity %i", entry.leaderboardType, entry.ActivityID);
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,4 @@ struct Migration {
|
||||
namespace MigrationRunner {
|
||||
void RunMigrations();
|
||||
void RunSQLiteMigrations();
|
||||
void MigrateLeaderboard();
|
||||
};
|
||||
|
@ -37,8 +37,8 @@ public:
|
||||
Racing,
|
||||
MonumentRace,
|
||||
FootRace,
|
||||
UnusedLeaderboard4,// There is no 4 defined anywhere in the client or cdclient
|
||||
Survival = 5,
|
||||
UnusedLeaderboard4, // There is no 4 defined anywhere in the cdclient, but it takes a Score.
|
||||
Survival,
|
||||
SurvivalNS,
|
||||
Donations,
|
||||
None = UINT_MAX
|
||||
|
@ -202,9 +202,6 @@ int main(int argc, char** argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// This migration relies on cdclient data so run it last
|
||||
MigrationRunner::MigrateLeaderboard();
|
||||
|
||||
//If the first command line argument is -a or --account then make the user
|
||||
//input a username and password, with the password being hidden.
|
||||
if (argc > 1 &&
|
||||
|
@ -1 +0,0 @@
|
||||
# This migration is a mock. See the real migration in MigrationRunner::MigrateLeaderboard.
|
@ -1,8 +1,10 @@
|
||||
ALTER TABLE leaderboard
|
||||
ADD COLUMN hitPercentage FLOAT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN streak INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN bestLapTime FLOAT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN numWins INT NOT NULL DEFAULT 0,
|
||||
MODIFY time FLOAT NOT NULL DEFAULT 0;
|
||||
ALTER TABLE leaderboard
|
||||
ADD COLUMN hitPercentage FLOAT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN streak INT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN bestLapTime FLOAT NOT NULL DEFAULT 0,
|
||||
ADD COLUMN numWins INT NOT NULL DEFAULT 0,
|
||||
MODIFY time FLOAT NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE leaderboard CHANGE time bestTime float;
|
||||
|
||||
UPDATE leaderboard SET streak = bestTime where game_id = 1864;
|
||||
|
Loading…
Reference in New Issue
Block a user