Update sql to work

The old way was supposed to work but doesn't.  Oh well!
This commit is contained in:
David Markowitz 2023-06-05 02:24:00 -07:00
parent 59d7121978
commit 96fc6e81d8
2 changed files with 3 additions and 5 deletions

View File

@ -287,7 +287,7 @@ std::string FormatInsert(const Leaderboard::Type& type, const Score& score, cons
constexpr uint16_t STRING_LENGTH = 400;
// Then fill in our score
char finishedQuery[STRING_LENGTH];
int32_t res = snprintf(finishedQuery, STRING_LENGTH, insertStatement.c_str(), score.GetPrimaryScore(), score.GetSecondaryScore(), score.GetTertiaryScore());
[[maybe_unused]] int32_t res = snprintf(finishedQuery, STRING_LENGTH, insertStatement.c_str(), score.GetPrimaryScore(), score.GetSecondaryScore(), score.GetTertiaryScore());
DluAssert(res != -1);
return finishedQuery;
}

View File

@ -7,10 +7,8 @@ ALTER TABLE leaderboard
/* Can only ALTER one column at a time... */
ALTER TABLE leaderboard
CHANGE last_played last_played TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
ALTER TABLE leaderboard RENAME COLUMN score TO primaryScore;
ALTER TABLE leaderboard RENAME COLUMN time TO secondaryScore;
ALTER TABLE leaderboard MODIFY COLUMN secondaryScore FLOAT NOT NULL DEFAULT 0 AFTER primaryScore;
ALTER TABLE leaderboard MODIFY COLUMN primaryScore FLOAT NOT NULL DEFAULT 0;
ALTER TABLE leaderboard CHANGE score primaryScore FLOAT NOT NULL DEFAULT 0;
ALTER TABLE leaderboard CHANGE time secondaryScore FLOAT NOT NULL DEFAULT 0 AFTER primaryScore;
/* A bit messy, but better than going through a bunch of code fixes all to be run once. */
UPDATE leaderboard SET