This commit is contained in:
ilyastar9999
2025-12-03 13:52:28 +03:00
parent 07b338e823
commit 6f73f50f31
3 changed files with 57 additions and 10 deletions

View File

@@ -32,6 +32,17 @@ CREATE TABLE IF NOT EXISTS scoreboard_state (
UNIQUE(team_id, service_name)
);
-- Team scores table - track total and flag points over time
CREATE TABLE IF NOT EXISTS team_scores (
id SERIAL PRIMARY KEY,
team_id INTEGER NOT NULL,
team_name VARCHAR(255) NOT NULL,
total_score FLOAT DEFAULT 0,
flag_points FLOAT DEFAULT 0,
round INTEGER NOT NULL,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Attacks tracking table for scoreboard injector
CREATE TABLE IF NOT EXISTS attacks (
id SERIAL PRIMARY KEY,
@@ -84,6 +95,8 @@ ON CONFLICT (key) DO NOTHING;
-- Create indexes for performance
CREATE INDEX IF NOT EXISTS idx_scoreboard_state_team_service ON scoreboard_state(team_id, service_name);
CREATE INDEX IF NOT EXISTS idx_team_scores_round ON team_scores(round);
CREATE INDEX IF NOT EXISTS idx_team_scores_team_id ON team_scores(team_id);
CREATE INDEX IF NOT EXISTS idx_attacks_timestamp ON attacks(timestamp);
CREATE INDEX IF NOT EXISTS idx_attacks_our_attack ON attacks(is_our_attack);
CREATE INDEX IF NOT EXISTS idx_attacks_attack_to_us ON attacks(is_attack_to_us);