-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sql
More file actions
59 lines (50 loc) · 1.08 KB
/
setup.sql
File metadata and controls
59 lines (50 loc) · 1.08 KB
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
52
53
54
55
56
57
58
59
create table users (
id serial primary key,
firstname varchar(16) not null,
lastname varchar(16) not null,
email text not null unique,
password text not null,
description integer[]
);
create table menus (
id serial primary key,
date date unique
);
create table questions (
id serial primary key,
body text
);
create table answers (
id serial primary key,
question_id integer references questions,
body text,
place integer,
score integer
);
create table lunches (
lunch_id serial primary key,
time integer,
date date not null
);
create table lunches_users (
user_id integer references users,
lunch_id integer references lunches
);
create table lunchrequests (
id serial primary key,
time integer,
user_id integer references users
);
create table menus_questions (
menu_id integer references menus,
question_id integer references questions
);
create table answers_lunchrequests (
lunchrequest_id integer references lunchrequests,
answer_id integer references answers
);
create table distributions (
id serial primary key,
size integer unique not null,
proportion integer
);