-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprojectSQL.sql
More file actions
59 lines (52 loc) · 1.33 KB
/
Copy pathprojectSQL.sql
File metadata and controls
59 lines (52 loc) · 1.33 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
drop table if exists posts, comments , users, likes, deletedUsers, deletedPosts, deletedComments;
create table users (
id int auto_increment primary key not null,
name varchar(50),
email varchar(255) unique,
password varchar(255),
created_at DATETIME default now(),
accessLevel smallint default 0,
userProfilePic text
);
create table posts (
id int auto_increment primary key not null,
user_id int not null,
title varchar(75),
body text,
created_at DATETIME default now(),
imageUrl text,
FOREIGN KEY (user_id) references users(id) on delete cascade
);
create table comments (
id int auto_increment primary key not null,
comment varchar(50),
user_id int not null,
post_id int not null,
visible int,
FOREIGN KEY (user_id) references users(id) on delete cascade,
FOREIGN KEY (post_id) references posts(id) on delete cascade
);
create table deletedComments(
id int,
comment text,
user_id int,
post_id int,
visible int
);
create table deletedUsers(
id int,
name varchar(50),
email varchar(255),
password varchar(255),
deleted_at datetime,
accessLevel smallint,
userProfilePic text
);
create table deletedPosts(
id int,
user_id int,
title varchar(255),
body text,
deleted_at datetime,
imageUrl text
);