-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.sql
44 lines (37 loc) · 815 Bytes
/
create.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
use budget;
create table users (
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
email varchar(50) NOT NULL,
pass varchar(50)
);
create table budgets(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
name varchar(50) NOT NULL,
amount int NOT NULL
);
create table budgetauth (
user int NOT NULL,
budget int NOT NULL,
admin bool NOT NULL,
primary key (user, budget)
);
create table items(
id int NOT NULL AUTO_INCREMENT PRIMARY KEY,
budget int NOT NULL,
name varchar(50),
mincost int NOT NULL,
maxcost int NOT NULL
);
create table selections(
user int NOT NULL,
item int NOT NULL,
amount int NOT NULL,
primary key (user, item)
);
create table comments(
id int NOT NULL PRIMARY KEY AUTO_INCREMENT,
user int NOT NULL,
item int NOT NULL,
time timestamp NOT NULL,
comment mediumtext NOT NULL
);