X-Git-Url: https://git.toastfreeware.priv.at/toast/confclerk.git/blobdiff_plain/f657e9c7de107454db654af8cb44a5461870ddaf..80589bbd26540449bb409744dfaffbf889ace7d5:/src/create_tables.sql

diff --git a/src/create_tables.sql b/src/create_tables.sql
index 2f9a90a..122c1cf 100644
--- a/src/create_tables.sql
+++ b/src/create_tables.sql
@@ -10,29 +10,29 @@ CREATE TABLE CONFERENCE ( id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL
     , day_change INTEGER
     , timeslot_duration INTEGER
     , active INTEGER DEFAULT 0
-    , url VARCHAR
-    , map VARCHAR);
+    , url VARCHAR);
 
 CREATE TABLE TRACK ( id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL
-    , xid_conference INTEGER -- NOT NULL
+    , xid_conference INTEGER NOT NULL
     , name VARCHAR NOT NULL
     , UNIQUE (xid_conference, name));
 
-CREATE TABLE ROOM ( id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL
-    , xid_conference INTEGER -- NOT NULL
+CREATE TABLE ROOM ( id INTEGER PRIMARY KEY AUTOINCREMENT  NOT NULL
+    , xid_conference INTEGER NOT NULL
     , name VARCHAR NOT NULL
     , picture VARCHAR NOT NULL
     , UNIQUE (xid_conference, name));
 
-CREATE TABLE PERSON ( id INTEGER PRIMARY KEY  NOT NULL
-    , xid_conference INTEGER -- NOT NULL
+CREATE TABLE PERSON ( id INTEGER NOT NULL
+    , xid_conference INTEGER NOT NULL
     , name VARCHAR NOT NULL
-    , UNIQUE (xid_conference, name)); 
+    , UNIQUE (xid_conference, name)
+    , PRIMARY KEY (id, xid_conference)); 
 
 CREATE TABLE EVENT ( xid_conference INTEGER  NOT NULL
     , id INTEGER NOT NULL
     , start INTEGER NOT NULL
-    , duration INTEGER NOT NULL
+    , duration INTEGER NOT NULL -- duration of the event in seconds
     , xid_track INTEGER NOT NULL REFERENCES TRACK(id)
     , type VARCHAR
     , language VARCHAR
@@ -53,8 +53,7 @@ CREATE TABLE EVENT_PERSON ( xid_conference INTEGER NOT NULL
     , UNIQUE ( xid_conference , xid_event , xid_person ) ON CONFLICT REPLACE
     , FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id)
     , FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id)
-    , FOREIGN KEY(xid_person) REFERENCES PERSON(id));
-
+    , FOREIGN KEY(xid_conference, xid_person) REFERENCES PERSON(xid_conference, id));
 
 CREATE TABLE EVENT_ROOM ( xid_conference INTEGER NOT NULL
     , xid_event INTEGER NOT NULL
@@ -62,7 +61,7 @@ CREATE TABLE EVENT_ROOM ( xid_conference INTEGER NOT NULL
     , UNIQUE ( xid_conference , xid_event , xid_room ) ON CONFLICT REPLACE
     , FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id)
     , FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id)
-    , FOREIGN KEY(xid_room) REFERENCES ROOM(id));
+    , FOREIGN KEY(xid_conference, xid_room) REFERENCES ROOM(xid_conference, id));
 
 CREATE TABLE LINK ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
     , xid_conference INTEGER NOT NULL
