]> git.sesse.net Git - ccbs/commitdiff
Even more SQL syntax fixes (the schemas import into psql now).
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 13 Feb 2005 16:05:57 +0000 (16:05 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 13 Feb 2005 16:05:57 +0000 (16:05 +0000)
ccbs.sql

index 95ed22ee51b02c1e5b888ceeafbb3af43775c13d..74fa4394c2f77028a0b940ad765f43f696674a5b 100644 (file)
--- 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)
 );