mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
feat: persist ranked season rollovers
This commit is contained in:
@@ -112,6 +112,17 @@ CREATE TABLE seasons (
|
||||
rolled_over_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
CREATE TABLE ranked_season_rollovers (
|
||||
player_id TEXT NOT NULL REFERENCES identities(player_id),
|
||||
season_id TEXT NOT NULL REFERENCES seasons(season_id),
|
||||
rating DOUBLE PRECISION NOT NULL,
|
||||
deviation DOUBLE PRECISION NOT NULL,
|
||||
volatility DOUBLE PRECISION NOT NULL,
|
||||
ranked_games INTEGER NOT NULL CHECK (ranked_games >= 0),
|
||||
rolled_over_at TIMESTAMPTZ NOT NULL,
|
||||
PRIMARY KEY (player_id, season_id)
|
||||
);
|
||||
|
||||
CREATE TABLE penalties (
|
||||
penalty_id TEXT PRIMARY KEY,
|
||||
player_id TEXT NOT NULL REFERENCES identities(player_id),
|
||||
|
||||
@@ -38,6 +38,8 @@ class MigrationTest(unittest.TestCase):
|
||||
def test_seasons_are_ranked_only_and_penalties_are_durable(self):
|
||||
self.assertIn("CHECK (playlist = 'ranked')", SQL)
|
||||
self.assertIn("CREATE TABLE penalties", SQL)
|
||||
self.assertIn("CREATE TABLE ranked_season_rollovers", SQL)
|
||||
self.assertIn("PRIMARY KEY (player_id, season_id)", SQL)
|
||||
self.assertIn("REFERENCES identities(player_id)", SQL)
|
||||
self.assertIn("REFERENCES matches(match_id)", SQL)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user