-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtables_structure.sql
39 lines (36 loc) · 1.1 KB
/
tables_structure.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
create table tbl_collection
(
id int auto_increment
primary key,
user_id int not null,
name varchar(25) not null,
parent_id int null,
constraint fk_tbl_collection_parent_id__id
foreign key (parent_id) references tbl_collection (id),
constraint fk_tbl_collection_user_id__id
foreign key (user_id) references tbl_user (id)
);
create table tbl_highlight
(
id int auto_increment
primary key,
content varchar(255) not null,
user_id int not null,
constraint fk_tbl_highlight_user_id__id
foreign key (user_id) references tbl_user (id)
);
create table tbl_highlight_storage
(
highlight_id int not null,
collection_id int not null,
primary key (highlight_id, collection_id),
constraint fk_tbl_highlight_storage_collection_id__id
foreign key (collection_id) references tbl_collection (id),
constraint fk_tbl_highlight_storage_highlight_id__id
foreign key (highlight_id) references tbl_highlight (id)
);
create table tbl_user
(
id int auto_increment
primary key
);