- UNIQUE (tournament, round, parallel, player, songnumber),
- PRIMARY KEY (tournament, round, parallel, player, song)
+ PRIMARY KEY (tournament, round, parallel, player, songnumber)
+);
+
+CREATE TABLE randomsongsused (
+ song INTEGER NOT NULL PRIMARY KEY REFERENCES songs
+);
+
+CREATE SCHEMA bigscreen;
+
+CREATE TABLE bigscreen.active_tournament (
+ tournament INTEGER NOT NULL PRIMARY KEY REFERENCES tournaments
+);
+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, parallel ),
+ FOREIGN KEY ( tournament, round, parallel ) REFERENCES groups
+);
+CREATE TABLE bigscreen.active_screens (
+ id VARCHAR NOT NULL PRIMARY KEY