🚀 Patch auto

This commit is contained in:
karim hassan
2025-08-24 23:00:40 +00:00
parent 92e6afff00
commit f1103d67a0
1314 changed files with 2511 additions and 562 deletions

31
sql/schema.sql Normal file
View File

@@ -0,0 +1,31 @@
-- 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()
);

11
sql/seed.sql Normal file
View File

@@ -0,0 +1,11 @@
INSERT INTO tournaments(name, location, start_date, end_date, description)
VALUES ('Super Sunday #1', 'Padel Club', CURRENT_DATE + INTERVAL '7 day', CURRENT_DATE + INTERVAL '7 day', 'Tournoi amical'),
('Super Sunday #2', 'Central Court', CURRENT_DATE + INTERVAL '14 day', CURRENT_DATE + INTERVAL '14 day', 'Americano vibes')
ON CONFLICT DO NOTHING;
-- Participants for tournament 1
INSERT INTO participants(tournament_id, name, rating)
SELECT t.id, p.name, p.rating
FROM (VALUES ('Player A', 4.0), ('Player B', 4.2), ('Player C', 3.8), ('Player D', 4.1)) AS p(name, rating),
(SELECT id FROM tournaments WHERE name='Super Sunday #1' LIMIT 1) t;