14 lines
435 B
SQL
14 lines
435 B
SQL
-- Ensure basic matches table exists
|
|
CREATE TABLE IF NOT EXISTS matches (
|
|
id SERIAL PRIMARY KEY,
|
|
tournament_id INT NOT NULL REFERENCES tournaments(id) ON DELETE CASCADE,
|
|
player_a_id INT REFERENCES participants(id),
|
|
player_b_id INT REFERENCES participants(id),
|
|
court TEXT,
|
|
start_time TIMESTAMP NULL,
|
|
score_a INT DEFAULT 0,
|
|
score_b INT DEFAULT 0,
|
|
finished BOOLEAN DEFAULT FALSE,
|
|
created_at TIMESTAMP DEFAULT now()
|
|
);
|