schema.sql 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. DROP TABLE IF EXISTS Cts_times;
  2. CREATE TABLE Cts_times(
  3. mapid TEXT,
  4. gametype TEXT,
  5. trank INT,
  6. tvalue INT,
  7. PRIMARY KEY (mapid, gametype, trank),
  8. FOREIGN KEY (mapid, gametype, trank) REFERENCES Cts_ranks(mapid, gametype, idrank)
  9. );
  10. DROP TABLE IF EXISTS Cts_ranks;
  11. CREATE TABLE Cts_ranks(
  12. mapid TEXT,
  13. gametype TEXT,
  14. idrank INT,
  15. idvalue TEXT,
  16. PRIMARY KEY (mapid, gametype, idrank)
  17. );
  18. DROP TABLE IF EXISTS Id2alias;
  19. CREATE TABLE Id2alias(
  20. rtype TEXT,
  21. cryptokey TEXT,
  22. alias TEXT,
  23. PRIMARY KEY (cryptokey)
  24. );
  25. -- These table fields are unaltered.
  26. -- Exerpts from source/qcsrc/race.qc
  27. -- // player improved his existing record, only have to iterate on ranks between new and old recs
  28. -- for (i = prevpos; i > newpos; --i)
  29. -- {
  30. -- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
  31. -- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
  32. -- }
  33. -- ....
  34. -- // store new time itself
  35. -- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
  36. -- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
  37. -- re: foreign key from & to Cts_ranks & Id2alias.
  38. -- An ranked unregistered player will have a row in Cts_ranks, but will not have a row in Id2alias.
  39. -- A registered player may have a row in Id2alias, but may not necessary have a rank.