]> git.sesse.net Git - ccbs/commitdiff
More (minor) adjustments to the schemas.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 13 Feb 2005 15:59:05 +0000 (15:59 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 13 Feb 2005 15:59:05 +0000 (15:59 +0000)
ccbs.sql

index 3b3c4e73e1c3360a85fe1690761bc2c50422e27c..0fc451bf3f70b5eaa419d20458bf8b81318474ad 100644 (file)
--- a/ccbs.sql
+++ b/ccbs.sql
@@ -76,12 +76,14 @@ CREATE TABLE scores (
        player INTEGER NOT NULL REFERENCES players,
        
        song INTEGER NOT NULL REFERENCES songs,
-       playmode VARCHAR NOT NULL CHECK playmode IN ('single','double'),
-       difficulty VARCHAR NOT NULL CHECK 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 (tournament, round, parallel) REFERENCES groups (tournament, round, parallel),
-       PRIMARY KEY (tournament, round, parallel, player, songs)
-);     
+       FOREIGN KEY (tournament, round, parallel, player) REFERENCES roundparticipation (tournament, round, parallel, player),
+       PRIMARY KEY (tournament, round, parallel, player, song)
+);