-
Notifications
You must be signed in to change notification settings - Fork 1
/
monitor.sql
43 lines (36 loc) · 1.55 KB
/
monitor.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
drop table if exists `pictures`;
drop table if exists `files`;
drop table if exists `posts`;
create table `posts` (
`post_id` bigint(20) NOT NULL AUTO_INCREMENT,
`publish_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`web` varchar(256) NOT NULL,
`detail` varchar(256) NOT NULL,
`title` varchar(1024) NOT NULL,
`content` text NOT NULL,
PRIMARY KEY(`post_id`)
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
create table `files` (
`file_id` bigint(20) NOT NULL AUTO_INCREMENT,
`file_name` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`url` varchar(256) NOT NULL,
`post_id` bigint(20) NOT NULL,
PRIMARY KEY(`file_id`),
FOREIGN KEY (`post_id`) REFERENCES posts(`post_id`)
)ENGINE=InnoDB AUTO_INCREMENT=200001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
create table `pictures` (
`picture_id` bigint(20) NOT NULL AUTO_INCREMENT,
`picture_name` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`url` varchar(256) NOT NULL,
`post_id` bigint(20) NOT NULL,
PRIMARY KEY(`picture_id`),
FOREIGN KEY (`post_id`) REFERENCES posts(`post_id`)
)ENGINE=InnoDB AUTO_INCREMENT=500001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
drop table if exists `receivers`;
create table `receivers` (
`receiver_id` bigint(20) NOT NULL AUTO_INCREMENT,
`email` varchar(256) NOT NULL,
`name` varchar(256) NOT NULL,
`subscription` int(5) NOT NULL,
PRIMARY KEY(`receiver_id`)
)ENGINE=InnoDB AUTO_INCREMENT=800001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;