X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=ccbs.sql;h=74fa4394c2f77028a0b940ad765f43f696674a5b;hp=95ed22ee51b02c1e5b888ceeafbb3af43775c13d;hb=52fe6d6e5996a5d8270dc524a776b45dbf11ce2c;hpb=6e071023ea8f9715cb58602675ef305994f298c8 diff --git a/ccbs.sql b/ccbs.sql index 95ed22e..74fa439 100644 --- a/ccbs.sql +++ b/ccbs.sql @@ -25,7 +25,7 @@ CREATE TABLE seasons ( name VARCHAR NOT NULL ); -CREATE TABLE tournament ( +CREATE TABLE tournaments ( tournament SERIAL PRIMARY KEY, season INTEGER NOT NULL REFERENCES seasons, name VARCHAR NOT NULL @@ -77,14 +77,14 @@ CREATE TABLE scores ( player INTEGER NOT NULL REFERENCES players, song INTEGER NOT NULL REFERENCES songs, - playmode VARCHAR CHECK playmode IS NULL OR playmode IN ('single','double'), - difficulty VARCHAR CHECK difficulty IS NULL OR difficulty IN ('beginner','standard','difficult','expert','challenge'), + playmode VARCHAR CHECK (playmode IS NULL OR playmode IN ('single','double')), + difficulty VARCHAR CHECK (difficulty IS NULL OR difficulty IN ('beginner','standard','difficult','expert','challenge')), chosen BOOLEAN NOT NULL, score INTEGER NOT NULL CHECK (score >= 0 AND score <= 10000), FOREIGN KEY (song) REFERENCES songs (song), - FOREIGN KEY (song, playmode, difficulty) REFERENCES songs (song, playmode, difficulty), + FOREIGN KEY (song, playmode, difficulty) REFERENCES songratings (song, playmode, difficulty), FOREIGN KEY (tournament, round, parallel, player) REFERENCES roundparticipation (tournament, round, parallel, player), PRIMARY KEY (tournament, round, parallel, player, song) );