This commit is contained in:
ilyastar9999
2025-12-03 13:46:00 +03:00
parent bf764601d2
commit 07b338e823
2 changed files with 72 additions and 42 deletions

View File

@@ -21,6 +21,17 @@ CREATE TABLE IF NOT EXISTS service_logs (
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Scoreboard state table - current flags count for each team+service
CREATE TABLE IF NOT EXISTS scoreboard_state (
id SERIAL PRIMARY KEY,
team_id INTEGER NOT NULL,
service_name VARCHAR(255) NOT NULL,
stolen_flags INTEGER DEFAULT 0,
lost_flags INTEGER DEFAULT 0,
last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(team_id, service_name)
);
-- Attacks tracking table for scoreboard injector
CREATE TABLE IF NOT EXISTS attacks (
id SERIAL PRIMARY KEY,
@@ -72,6 +83,7 @@ INSERT INTO settings (key, value) VALUES
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_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);