Changeset 4403ab4 for src


Ignore:
Timestamp:
09/25/12 20:34:57 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
38b61bc
Parents:
5293ef0
Message:

Changed coding style of sql file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/dbschema001.sql

    r5293ef0 r4403ab4  
    11BEGIN TRANSACTION;
    2 CREATE TABLE CONFERENCE ( id INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL
    3     , title VARCHAR NOT NULL
    4     , subtitle VARCHAR
    5     , venue VARCHAR
    6     , city VARCHAR
    7     , start INTEGER NOT NULL -- timestamp (Unix Epoch)
    8     , end INTEGER NOT NULL   -- timestamp (Unix Epoch)
    9     , day_change INTEGER
    10     , timeslot_duration INTEGER
    11     , active INTEGER DEFAULT 0
    12     , url VARCHAR);
    132
    14 CREATE TABLE TRACK ( id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL
    15     , xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id)
    16     , name VARCHAR NOT NULL
    17     , UNIQUE (xid_conference, name));
     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, -- timestamp (Unix Epoch)
     10        end INTEGER NOT NULL,   -- timestamp (Unix Epoch)
     11        day_change INTEGER,
     12        timeslot_duration INTEGER,
     13        active INTEGER DEFAULT 0,
     14        url VARCHAR
     15);
    1816
    19 CREATE TABLE ROOM ( id INTEGER PRIMARY KEY AUTOINCREMENT  NOT NULL
    20     , xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id)
    21     , name VARCHAR NOT NULL
    22     , picture VARCHAR
    23     , UNIQUE (xid_conference, name));
     17CREATE TABLE TRACK (
     18        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
     19        xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id),
     20        name VARCHAR NOT NULL,
     21        UNIQUE (xid_conference, name)
     22);
    2423
    25 CREATE TABLE PERSON ( id INTEGER NOT NULL
    26     , xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id)
    27     , name VARCHAR NOT NULL
    28     , PRIMARY KEY (id, xid_conference));
     24CREATE TABLE ROOM (
     25        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
     26        xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id),
     27        name VARCHAR NOT NULL,
     28        picture VARCHAR,
     29        UNIQUE (xid_conference, name)
     30);
    2931
    30 CREATE TABLE EVENT ( xid_conference INTEGER  NOT NULL REFERENCES CONFERENCE(id)
    31     , id INTEGER NOT NULL
    32     , start INTEGER NOT NULL
    33     , duration INTEGER NOT NULL -- duration of the event in seconds
    34     , xid_track INTEGER NOT NULL REFERENCES TRACK(id)
    35     , type VARCHAR
    36     , language VARCHAR
    37     , tag VARCHAR
    38     , title VARCHAR NOT NULL
    39     , subtitle VARCHAR
    40     , abstract VARCHAR
    41     , description VARCHAR
    42     , favourite INTEGER DEFAULT 0
    43     , alarm INTEGER DEFAULT 0
    44     , PRIMARY KEY (xid_conference ,id));
     32CREATE TABLE PERSON (
     33        id INTEGER NOT NULL,
     34        xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id),
     35        name VARCHAR NOT NULL,
     36        PRIMARY KEY (id, xid_conference)
     37);
    4538
    46 CREATE TABLE EVENT_PERSON ( xid_conference INTEGER NOT NULL
    47     , xid_event INTEGER NOT NULL
    48     , xid_person INTEGER NOT NULL
    49     , UNIQUE ( xid_conference , xid_event , xid_person ) ON CONFLICT REPLACE
    50     , FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id)
    51     , FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id)
    52     , FOREIGN KEY(xid_conference, xid_person) REFERENCES PERSON(xid_conference, id));
     39CREATE TABLE EVENT (
     40        xid_conference INTEGER NOT NULL REFERENCES CONFERENCE(id),
     41        id INTEGER NOT NULL,
     42        start INTEGER NOT NULL,
     43        duration INTEGER NOT NULL, -- duration of the event in seconds
     44        xid_track INTEGER NOT NULL REFERENCES TRACK(id),
     45        type VARCHAR,
     46        language VARCHAR,
     47        tag VARCHAR,
     48        title VARCHAR NOT NULL,
     49        subtitle VARCHAR,
     50        abstract VARCHAR,
     51        description VARCHAR,
     52        favourite INTEGER DEFAULT 0,
     53        alarm INTEGER DEFAULT 0,
     54        PRIMARY KEY (xid_conference, id)
     55);
    5356
    54 CREATE TABLE EVENT_ROOM ( xid_conference INTEGER NOT NULL
    55     , xid_event INTEGER NOT NULL
    56     , xid_room INTEGER NOT NULL
    57     , UNIQUE ( xid_conference , xid_event , xid_room ) ON CONFLICT REPLACE
    58     , FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id)
    59     , FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id)
    60     , FOREIGN KEY(xid_conference, xid_room) REFERENCES ROOM(xid_conference, id));
     57CREATE TABLE EVENT_PERSON (
     58        xid_conference INTEGER NOT NULL,
     59        xid_event INTEGER NOT NULL,
     60        xid_person INTEGER NOT NULL,
     61        UNIQUE (xid_conference, xid_event, xid_person ) ON CONFLICT REPLACE,
     62        FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id),
     63        FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id),
     64        FOREIGN KEY(xid_conference, xid_person) REFERENCES PERSON(xid_conference, id)
     65);
    6166
    62 CREATE TABLE LINK ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
    63     , xid_conference INTEGER NOT NULL
    64     , xid_event INTEGER NOT NULL
    65     , name VARCHAR
    66     , url VARCHAR NOT NULL
    67     , UNIQUE ( xid_conference , xid_event , url ) ON CONFLICT REPLACE
    68     , FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id)
    69     , FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id));
     67CREATE TABLE EVENT_ROOM (
     68        xid_conference INTEGER NOT NULL,
     69        xid_event INTEGER NOT NULL,
     70        xid_room INTEGER NOT NULL,
     71        UNIQUE (xid_conference, xid_event, xid_room) ON CONFLICT REPLACE,
     72        FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id),
     73        FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id),
     74        FOREIGN KEY(xid_conference, xid_room) REFERENCES ROOM(xid_conference, id)
     75);
     76
     77CREATE TABLE LINK (
     78        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
     79        xid_conference INTEGER NOT NULL,
     80        xid_event INTEGER NOT NULL,
     81        name VARCHAR,
     82        url VARCHAR NOT NULL,
     83        UNIQUE (xid_conference, xid_event , url) ON CONFLICT REPLACE,
     84        FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id),
     85        FOREIGN KEY(xid_conference, xid_event) REFERENCES EVENT(xid_conference, id)
     86);
    7087
    7188PRAGMA user_version=1;
     89
    7290COMMIT;
Note: See TracChangeset for help on using the changeset viewer.