X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=sql%2Fccbs.sql;h=45897b336befe8d0435c231854eeb47b00475d9d;hp=c13c666774d872d199351fe59b01ba43fa468f3d;hb=81edbdf60931cc5343964a86e95a43a4dfd6d103;hpb=c73f95e10416d77bea35c2e409f3d6cd4b81143a diff --git a/sql/ccbs.sql b/sql/ccbs.sql index c13c666..45897b3 100644 --- a/sql/ccbs.sql +++ b/sql/ccbs.sql @@ -136,16 +136,14 @@ CREATE TABLE scores ( player INTEGER NOT NULL REFERENCES players, songnumber INTEGER NOT NULL, - song INTEGER NOT NULL REFERENCES songs, + song INTEGER 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')), - chosen BOOLEAN NOT NULL, - score INTEGER NOT NULL CHECK (score >= 0 AND score <= 10000), + chosen BOOLEAN, + score INTEGER CHECK (score IS NULL OR (score >= 0 AND score <= 10000)), - 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, songnumber) );