merge branch 'import script', squashed

This commit is contained in:
2024-10-13 12:38:11 -07:00
parent f17c6a8f68
commit ded4e29594
3 changed files with 276 additions and 5 deletions

41
queries/schema.sql Normal file
View File

@@ -0,0 +1,41 @@
DROP TABLE IF EXISTS Cts_times;
CREATE TABLE Cts_times(
mapid TEXT,
gametype TEXT,
trank INT,
tvalue INT,
PRIMARY KEY (mapid, gametype, trank),
FOREIGN KEY (mapid, gametype, trank) REFERENCES Cts_ranks(mapid, gametype, idrank)
);
DROP TABLE IF EXISTS Cts_ranks;
CREATE TABLE Cts_ranks(
mapid TEXT,
gametype TEXT,
idrank INT,
idvalue TEXT,
PRIMARY KEY (mapid, gametype, idrank)
);
DROP TABLE IF EXISTS Id2alias;
CREATE TABLE Id2alias(
rtype TEXT,
cryptokey TEXT,
alias TEXT,
PRIMARY KEY (cryptokey)
);
-- These table fields are unaltered.
-- Exerpts from source/qcsrc/race.qc
-- // player improved his existing record, only have to iterate on ranks between new and old recs
-- for (i = prevpos; i > newpos; --i)
-- {
-- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
-- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
-- }
-- ....
-- // store new time itself
-- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
-- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
-- re: foreign key from & to Cts_ranks & Id2alias.
-- An ranked unregistered player will have a row in Cts_ranks, but will not have a row in Id2alias.
-- A registered player may have a row in Id2alias, but may not necessary have a rank.