source: src/dbschema002.sql @ 0b4a1d0

Last change on this file since 0b4a1d0 was 0b4a1d0, checked in by Philipp Spitzer <philipp@…>, 13 months ago

Add comment for day_change field in conference table definition.

  • Property mode set to 100644
File size: 2.9 KB
Line 
1BEGIN TRANSACTION;
2
3CREATE TABLE conference (
4        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
5        title VARCHAR NOT NULL,
6        subtitle VARCHAR,
7        venue VARCHAR,
8        city VARCHAR,
9        start INTEGER NOT NULL, -- timezone-less timestamp (Unix Epoch)
10        end INTEGER NOT NULL,   -- timezone-less timestamp (Unix Epoch)
11        day_change INTEGER, -- in seconds after midnight
12        timeslot_duration INTEGER,
13        utc_offset INTEGER DEFAULT NULL, -- if known, conference UTC offset in seconds (e.g. CET = +3600)
14        display_time_shift INTEGER DEFAULT NULL, -- if not null, add number in seconds to conference times when showing times
15        active INTEGER DEFAULT 0,
16        url VARCHAR
17);
18
19CREATE TABLE track (
20        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
21        xid_conference INTEGER NOT NULL REFERENCES conference(id),
22        name VARCHAR NOT NULL,
23        UNIQUE (xid_conference, name)
24);
25
26CREATE TABLE room (
27        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
28        xid_conference INTEGER NOT NULL REFERENCES conference(id),
29        name VARCHAR NOT NULL,
30        picture VARCHAR,
31        UNIQUE (xid_conference, name)
32);
33
34CREATE TABLE person (
35        id INTEGER NOT NULL,
36        xid_conference INTEGER NOT NULL REFERENCES conference(id),
37        name VARCHAR NOT NULL,
38        PRIMARY KEY (id, xid_conference)
39);
40
41CREATE TABLE event (
42        xid_conference INTEGER NOT NULL REFERENCES conference(id),
43        id INTEGER NOT NULL,
44        start INTEGER NOT NULL,    -- timezone-less timestamp (Unix Epoch)
45        duration INTEGER NOT NULL, -- duration of the event in seconds
46        xid_track INTEGER NOT NULL REFERENCES track(id),
47        type VARCHAR,
48        language VARCHAR,
49        tag VARCHAR,
50        title VARCHAR NOT NULL,
51        subtitle VARCHAR,
52        abstract VARCHAR,
53        description VARCHAR,
54        favourite INTEGER DEFAULT 0, -- 0 ... no favourite, 1 ... strong favourite, 2 ... weak favourite/alternative to strong favourite
55        alarm INTEGER DEFAULT 0,
56        PRIMARY KEY (xid_conference, id)
57);
58
59CREATE TABLE event_person (
60        xid_conference INTEGER NOT NULL,
61        xid_event INTEGER NOT NULL,
62        xid_person INTEGER NOT NULL,
63        UNIQUE (xid_conference, xid_event, xid_person ) ON CONFLICT REPLACE,
64        FOREIGN KEY(xid_conference) REFERENCES conference(id),
65        FOREIGN KEY(xid_conference, xid_event) REFERENCES event(xid_conference, id),
66        FOREIGN KEY(xid_conference, xid_person) REFERENCES person(xid_conference, id)
67);
68
69CREATE TABLE event_room (
70        xid_conference INTEGER NOT NULL,
71        xid_event INTEGER NOT NULL,
72        xid_room INTEGER NOT NULL,
73        UNIQUE (xid_conference, xid_event, xid_room) ON CONFLICT REPLACE,
74        FOREIGN KEY(xid_conference) REFERENCES conference(id),
75        FOREIGN KEY(xid_conference, xid_event) REFERENCES event(xid_conference, id),
76        FOREIGN KEY(xid_conference, xid_room) REFERENCES room(xid_conference, id)
77);
78
79CREATE TABLE link (
80        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
81        xid_conference INTEGER NOT NULL,
82        xid_event INTEGER NOT NULL,
83        name VARCHAR,
84        url VARCHAR NOT NULL,
85        UNIQUE (xid_conference, xid_event , url) ON CONFLICT REPLACE,
86        FOREIGN KEY(xid_conference) REFERENCES conference(id),
87        FOREIGN KEY(xid_conference, xid_event) REFERENCES event(xid_conference, id)
88);
89
90PRAGMA user_version=2;
91
92COMMIT;
Note: See TracBrowser for help on using the repository browser.