2.0.0-rc1 : Profile and achievements update.

This commit is contained in:
2026-08-09 00:50:45 +08:00
parent 562775e5db
commit 3874bf57a9
31 changed files with 2618 additions and 108 deletions
+166
View File
@@ -428,6 +428,165 @@ CREATE TABLE IF NOT EXISTS dm_player_records (
CREATE INDEX IF NOT EXISTS idx_player_records_player
ON dm_player_records(steam_id_64, record_key);
-- ============================================================================
-- Team Mart: Duo performance
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_duo_stats (
steam_id_a TEXT NOT NULL,
steam_id_b TEXT NOT NULL,
matches INTEGER NOT NULL DEFAULT 0,
wins INTEGER NOT NULL DEFAULT 0,
win_rate REAL,
avg_rating_a REAL,
avg_rating_b REAL,
avg_combined_rating REAL,
first_match_date INTEGER,
last_match_date INTEGER,
sample_reliable BOOLEAN NOT NULL DEFAULT 0,
last_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (steam_id_a, steam_id_b)
);
CREATE INDEX IF NOT EXISTS idx_duo_stats_matches
ON dm_duo_stats(matches DESC, win_rate DESC);
-- ============================================================================
-- Team Mart: Actual 2-5 player combinations
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_lineup_stats (
lineup_key TEXT PRIMARY KEY,
player_ids_json TEXT NOT NULL,
player_count INTEGER NOT NULL,
matches INTEGER NOT NULL DEFAULT 0,
wins INTEGER NOT NULL DEFAULT 0,
win_rate REAL,
avg_team_rating REAL,
first_match_date INTEGER,
last_match_date INTEGER,
sample_reliable BOOLEAN NOT NULL DEFAULT 0,
last_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_lineup_stats_size_matches
ON dm_lineup_stats(player_count, matches DESC, win_rate DESC);
-- ============================================================================
-- Narrative Mart: Post-match team report
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_match_reports (
match_id TEXT PRIMARY KEY,
match_date INTEGER NOT NULL,
map_name TEXT,
roster_count INTEGER NOT NULL DEFAULT 0,
team_key INTEGER,
is_win BOOLEAN,
team_avg_rating REAL,
team_avg_adr REAL,
mvp_steam_id TEXT,
mvp_rating REAL,
improver_steam_id TEXT,
improver_delta REAL,
strongest_duo_json TEXT,
record_break_count INTEGER NOT NULL DEFAULT 0,
summary_text TEXT,
last_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_match_reports_date
ON dm_match_reports(match_date DESC);
-- ============================================================================
-- Narrative Mart: Player performance vs prior form
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_match_player_reports (
match_id TEXT NOT NULL,
steam_id_64 TEXT NOT NULL,
match_date INTEGER NOT NULL,
rating REAL,
kd_ratio REAL,
adr REAL,
kills INTEGER,
deaths INTEGER,
baseline_matches INTEGER NOT NULL DEFAULT 0,
prior_20_rating REAL,
prior_20_kd REAL,
prior_20_adr REAL,
rating_delta REAL,
kd_delta REAL,
adr_delta REAL,
performance_label TEXT,
record_keys_json TEXT NOT NULL DEFAULT '[]',
PRIMARY KEY (match_id, steam_id_64)
);
CREATE INDEX IF NOT EXISTS idx_match_player_reports_player_date
ON dm_match_player_reports(steam_id_64, match_date DESC);
-- ============================================================================
-- Narrative Mart: Every career-record breaking event
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_player_record_events (
steam_id_64 TEXT NOT NULL,
record_key TEXT NOT NULL,
match_id TEXT NOT NULL,
match_date INTEGER NOT NULL,
map_name TEXT,
previous_value REAL,
record_value REAL NOT NULL,
is_current_record BOOLEAN NOT NULL DEFAULT 0,
PRIMARY KEY (steam_id_64, record_key, match_id)
);
CREATE INDEX IF NOT EXISTS idx_record_events_player_date
ON dm_player_record_events(steam_id_64, match_date DESC);
-- ============================================================================
-- Team Mart: Calendar season performance
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_team_season_stats (
season_key TEXT PRIMARY KEY,
season_label TEXT NOT NULL,
period_start INTEGER NOT NULL,
period_end INTEGER NOT NULL,
matches INTEGER NOT NULL DEFAULT 0,
wins INTEGER NOT NULL DEFAULT 0,
losses INTEGER NOT NULL DEFAULT 0,
win_rate REAL,
avg_team_rating REAL,
best_map TEXT,
best_map_win_rate REAL,
top_player_steam_id TEXT,
top_player_rating REAL,
last_updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- ============================================================================
-- Award Mart: Best player by calendar period
-- ============================================================================
CREATE TABLE IF NOT EXISTS dm_player_awards (
award_type TEXT NOT NULL,
period_key TEXT NOT NULL,
period_label TEXT NOT NULL,
period_start INTEGER NOT NULL,
period_end INTEGER NOT NULL,
steam_id_64 TEXT NOT NULL,
matches INTEGER NOT NULL,
wins INTEGER NOT NULL,
win_rate REAL,
avg_rating REAL,
avg_kd REAL,
avg_adr REAL,
performance_score REAL,
sample_reliable BOOLEAN NOT NULL DEFAULT 0,
PRIMARY KEY (award_type, period_key)
);
CREATE INDEX IF NOT EXISTS idx_player_awards_player
ON dm_player_awards(steam_id_64, period_start DESC);
CREATE INDEX IF NOT EXISTS idx_player_awards_period
ON dm_player_awards(award_type, period_start DESC);
-- ============================================================================
-- Schema Summary
-- ============================================================================
@@ -443,4 +602,11 @@ ON dm_player_records(steam_id_64, record_key);
-- dm_player_weapon_stats: Weapon usage statistics
-- dm_player_period_stats: Career/recent time-window aggregations
-- dm_player_records: Career record values and source matches
-- dm_duo_stats: Same-team pair performance
-- dm_lineup_stats: Actual same-team 2-5 player combinations
-- dm_match_reports: Post-match team narrative
-- dm_match_player_reports: Player form deltas per match
-- dm_player_record_events: Historical record-breaking moments
-- dm_team_season_stats: Calendar season team summaries
-- dm_player_awards: Daily/weekly/monthly/quarterly/yearly awards
-- ============================================================================