Phase 23: season history + division zone data + new route
CI / Build, lint & test (push) Failing after 1m19s
CI / Build, lint & test (push) Failing after 1m19s
- migrations/0011_season_history.sql: persist one row per completed season - models/season.rs: SeasonHistoryEntry struct; public SEASON_LENGTH / PROMOTION_PTS / RELEGATION_PTS consts; pts_above_safe, can_be_relegated, promotion_achievable helpers - services/season.rs: write history entry on season rollover; get_history() returns last 20 seasons newest-first - routes/division.rs: GET /division now includes promotion_pts, relegation_pts, season_length, pts_above_safe, promotion_achievable, can_be_relegated; new GET /division/history endpoint - 3 new integration tests: history empty, history records after promotion, division response has zone fields Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
-- Season history: one row per completed season
|
||||
CREATE TABLE IF NOT EXISTS season_history (
|
||||
id TEXT PRIMARY KEY,
|
||||
profile_id TEXT NOT NULL,
|
||||
season_number INTEGER NOT NULL,
|
||||
division INTEGER NOT NULL,
|
||||
season_points INTEGER NOT NULL,
|
||||
wins INTEGER NOT NULL,
|
||||
draws INTEGER NOT NULL,
|
||||
losses INTEGER NOT NULL,
|
||||
result TEXT NOT NULL, -- 'promoted' | 'maintained' | 'relegated'
|
||||
new_division INTEGER NOT NULL,
|
||||
coins_awarded INTEGER NOT NULL,
|
||||
pack_awarded TEXT, -- nullable
|
||||
ended_at TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_season_history_profile ON season_history (profile_id, season_number DESC);
|
||||
Reference in New Issue
Block a user