X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=sql%2Fccbs.sql;h=839dd86879d6c9a2ff352caf2ea65d3b12a32879;hp=0140141c4e029195e2ad77254b105ac439a87350;hb=012a54e59c8d6cd27754c1abfc8a3fba3e2d0fab;hpb=0f22a1dac624ea27e58df298f6fd67020b1df294 diff --git a/sql/ccbs.sql b/sql/ccbs.sql index 0140141..839dd86 100644 --- a/sql/ccbs.sql +++ b/sql/ccbs.sql @@ -24,6 +24,14 @@ CREATE TABLE songs ( UNIQUE ( title ) ); +CREATE TABLE songshorttitles ( + song INTEGER NOT NULL REFERENCES songs, + shorttitle VARCHAR NOT NULL, + + PRIMARY KEY ( song, shorttitle ), + UNIQUE ( shorttitle ) +); + CREATE TABLE machinesongs ( song INTEGER NOT NULL REFERENCES songs, machine INTEGER NOT NULL REFERENCES machines, @@ -47,6 +55,7 @@ CREATE TABLE songratings ( PRIMARY KEY (song, machine, playmode, difficulty) ); +CREATE INDEX songratings_feetrating ON songratings ( feetrating ); CREATE TABLE players ( player SERIAL PRIMARY KEY, @@ -163,11 +172,17 @@ CREATE SCHEMA bigscreen; CREATE TABLE bigscreen.active_tournament ( tournament INTEGER NOT NULL PRIMARY KEY REFERENCES tournaments ); -CREATE TABLE bigscreen.active_rounds ( +CREATE TABLE bigscreen.active_groups ( tournament INTEGER NOT NULL REFERENCES bigscreen.active_tournament, round INTEGER NOT NULL, + parallel INTEGER NOT NULL, + num_machines INTEGER NOT NULL, + players_per_machine INTEGER NOT NULL CHECK ( players_per_machine IN (1, 2) ), + last_updated TIMESTAMP NOT NULL, - PRIMARY KEY ( tournament, round ), - FOREIGN KEY ( tournament, round ) REFERENCES rounds + PRIMARY KEY ( tournament, round, parallel ), + FOREIGN KEY ( tournament, round, parallel ) REFERENCES groups ); +CREATE TABLE bigscreen.active_screens ( + id VARCHAR NOT NULL PRIMARY KEY );