]> git.sesse.net Git - ccbs/commitdiff
Add a "song number" to the score schema.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 13 Feb 2005 23:27:02 +0000 (23:27 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 13 Feb 2005 23:27:02 +0000 (23:27 +0000)
sql/ccbs.sql

index b49a47e2781bc3f7717f7740630ab91581525e3f..e8045a0046ee21b8f52219c73f2bac3f061c8898 100644 (file)
@@ -115,6 +115,7 @@ CREATE TABLE scores (
        round INTEGER NOT NULL,
        parallel INTEGER NOT NULL,
        player INTEGER NOT NULL REFERENCES players,
        round INTEGER NOT NULL,
        parallel INTEGER NOT NULL,
        player INTEGER NOT NULL REFERENCES players,
+       songnumber INTEGER NOT NULL,
        
        song INTEGER NOT NULL REFERENCES songs,
        playmode VARCHAR CHECK (playmode IS NULL OR playmode IN ('single','double')),
        
        song INTEGER NOT NULL REFERENCES songs,
        playmode VARCHAR CHECK (playmode IS NULL OR playmode IN ('single','double')),
@@ -126,5 +127,6 @@ CREATE TABLE scores (
        FOREIGN KEY (song) REFERENCES songs (song),
        FOREIGN KEY (song, playmode, difficulty) REFERENCES songratings (song, playmode, difficulty),
        FOREIGN KEY (tournament, round, parallel, player) REFERENCES roundparticipation (tournament, round, parallel, player),
        FOREIGN KEY (song) REFERENCES songs (song),
        FOREIGN KEY (song, playmode, difficulty) REFERENCES songratings (song, playmode, difficulty),
        FOREIGN KEY (tournament, round, parallel, player) REFERENCES roundparticipation (tournament, round, parallel, player),
+       UNIQUE (tournament, round, parallel, player, songnumber),
        PRIMARY KEY (tournament, round, parallel, player, song)
 );
        PRIMARY KEY (tournament, round, parallel, player, song)
 );