forked from URLooker/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
100 lines (92 loc) · 3.68 KB
/
schema.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
CREATE DATABASE `urlooker`;
USE urlooker;
DROP TABLE IF EXISTS `strategy`;
CREATE TABLE `strategy` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`url` varchar(1024) NOT NULL,
`keywords` varchar(255) NOT NULL DEFAULT '',
`timeout` varchar(255) NOT NULL DEFAULT '',
`creator` varchar(255) NOT NULL DEFAULT '',
`data` varchar(1024) NOT NULL DEFAULT '',
`ip` varchar(255) NOT NULL DEFAULT '',
`expect_code` varchar(255) NOT NULL DEFAULT '',
`tag` varchar(255) NOT NULL DEFAULT '',
`note` varchar(255) NOT NULL DEFAULT '',
`max_step` int(4) NOT NULL DEFAULT 3,
`times` int(4) NOT NULL DEFAULT 3,
`teams` varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
#ALTER TABLE strategy ADD ip varchar(255);
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(64) NOT NULL,
`cnname` VARCHAR(64) NOT NULL DEFAULT '',
`password` VARCHAR(32) NOT NULL,
`email` VARCHAR(255) NOT NULL DEFAULT '',
`phone` VARCHAR(16) NOT NULL DEFAULT '',
`wechat` VARCHAR(255) NOT NULL DEFAULT '',
`role` TINYINT NOT NULL DEFAULT 0,
`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_user_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE if EXISTS team;
CREATE TABLE `team` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(64) NOT NULL,
`resume` VARCHAR(255) NOT NULL DEFAULT '',
`creator` BIGINT UNSIGNED NOT NULL,
`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_team_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE if EXISTS `rel_team_user`;
CREATE TABLE `rel_team_user` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`tid` BIGINT UNSIGNED NOT NULL,
`uid` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY `idx_rel_tid` (`tid`),
KEY `idx_rel_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `rel_sid_ip`;
CREATE TABLE `rel_sid_ip` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`sid` INT UNSIGNED NOT NULL,
`ip` VARCHAR(32) NOT NULL DEFAULT '',
`ts` INT(10),
PRIMARY KEY (`id`),
UNIQUE KEY `idx_sid_ip` (`sid`,`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `event`;
CREATE TABLE `event` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`event_id` VARCHAR(64) NOT NULL,
`status` VARCHAR(32) NOT NULL,
`url` VARCHAR(256) NOT NULL DEFAULT '',
`ip` VARCHAR(32) NOT NULL DEFAULT '',
`strategy_id` INT,
`event_time` INT(11),
`resp_time` INT(6),
`resp_code` VARCHAR(3),
`result` INT(1) NOT NULL DEFAULT 0 COMMENT '0:no error, 1:timeout, 2:expect code err, 3,keyword unmatch 4:dns err',
`current_step`INT(1),
`max_step` INT(1),
PRIMARY KEY (`id`),
INDEX `idx_strategy_id` (`strategy_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `item_status00`;
CREATE TABLE `item_status00` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`sid` INT UNSIGNED NOT NULL,
`ip` VARCHAR(32) NOT NULL DEFAULT '',
`resp_time` INT(6),
`resp_code` VARCHAR(3),
`push_time` INT(10),
`result` INT(1) NOT NULL DEFAULT 0 COMMENT '0:no error, 1:timeout, 2:expect code err, 3,keyword unmatch 4:dns err',
PRIMARY KEY (`id`),
INDEX `idx_ip` (`ip`),
INDEX `idx_sid` (`sid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;