-
Notifications
You must be signed in to change notification settings - Fork 0
/
corpse_relationsdatabasschema.sql
51 lines (45 loc) · 1.2 KB
/
corpse_relationsdatabasschema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
create table Story (
storyID varchar(255) primary key,
totalNumberOfPosts int,
completed boolean not null default false,
language varchar(63) references Languages(language),
points int default 0,
check (totalNumberOfPosts > 0),
check (points >= 0)
);
create table Post (
storyID varchar(255) references Story(storyID),
post text not null,
postNr varchar(11),
writtenBy varchar(63) references User(username) on update cascade,
dateWritten date,
language varchar(63) references Languages(language),
primary key (storyID, postNr),
check (postNr > 0)
);
create table StoryCharacter (
characterID int primary key,
name varchar(255) not null,
description text,
points int default 0,
createdBy varchar(63) references User(username) on update cascade,
check (points >= 0)
);
create table AppearsIn (
storyID int references Story(storyID),
characterID int references StoryCharacter(characterID)
);
create table User (
username varchar(63) primary key,
registered date,
email varchar(255),
picture mediumblob
);
create table Languages (
language varchar(63) not null
);
create table MenuItems (
itemOrder int,
itemName varchar(63),
itemLanguage varchar(63) references Languages(language)
);