asd
This commit is contained in:
12
init-db.sql
12
init-db.sql
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user