Files
SuperSunday/sql/schema.sql
karim hassan f1103d67a0 🚀 Patch auto
2025-08-24 23:00:40 +00:00

32 lines
759 B
SQL

-- Schema for Super Sunday
CREATE TABLE IF NOT EXISTS tournaments (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
location TEXT,
start_date DATE,
end_date DATE,
description TEXT,
created_at TIMESTAMP DEFAULT now()
);
CREATE TABLE IF NOT EXISTS participants (
id SERIAL PRIMARY KEY,
tournament_id INTEGER REFERENCES tournaments(id) ON DELETE CASCADE,
name TEXT NOT NULL,
rating NUMERIC,
created_at TIMESTAMP DEFAULT now()
);
CREATE TABLE IF NOT EXISTS matches (
id SERIAL PRIMARY KEY,
tournament_id INTEGER REFERENCES tournaments(id) ON DELETE CASCADE,
court TEXT,
start_time TIMESTAMP,
team_a TEXT,
team_b TEXT,
score_a INTEGER,
score_b INTEGER,
finished BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT now()
);