-
Notifications
You must be signed in to change notification settings - Fork 313
/
install.sql
278 lines (259 loc) · 9.91 KB
/
install.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
CREATE TABLE `t_action` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`action` varchar(20) NOT NULL DEFAULT '',
`actor` varchar(20) NOT NULL DEFAULT '',
`object_type` varchar(20) NOT NULL DEFAULT '',
`object_id` int(11) NOT NULL DEFAULT '0',
`extra` varchar(1000) NOT NULL DEFAULT '',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_env` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(20) NOT NULL DEFAULT '',
`ssh_user` varchar(20) NOT NULL DEFAULT '',
`ssh_port` varchar(10) NOT NULL DEFAULT '',
`ssh_key` varchar(100) NOT NULL DEFAULT '',
`pub_dir` varchar(100) NOT NULL DEFAULT '',
`before_shell` longtext NOT NULL,
`after_shell` longtext NOT NULL,
`server_count` int(11) NOT NULL DEFAULT '0',
`send_mail` int(11) NOT NULL DEFAULT '0',
`mail_tpl_id` int(11) NOT NULL DEFAULT '0',
`mail_to` varchar(1000) NOT NULL DEFAULT '',
`mail_cc` varchar(1000) NOT NULL DEFAULT '',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `t_env_project_id` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_env_server` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project_id` int(11) NOT NULL DEFAULT '0',
`env_id` int(11) NOT NULL DEFAULT '0',
`server_id` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `t_env_server_env_id` (`env_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_mail_tpl` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL DEFAULT '0',
`name` varchar(100) NOT NULL DEFAULT '',
`subject` varchar(200) NOT NULL DEFAULT '',
`content` longtext NOT NULL,
`mail_to` varchar(1000) NOT NULL DEFAULT '',
`mail_cc` varchar(1000) NOT NULL DEFAULT '',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_perm` (
`module` varchar(20) NOT NULL DEFAULT '' COMMENT '模块名',
`action` varchar(20) NOT NULL DEFAULT '' COMMENT '操作名',
UNIQUE KEY `module` (`module`,`action`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_project` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL DEFAULT '',
`domain` varchar(100) NOT NULL DEFAULT '',
`version` varchar(20) NOT NULL DEFAULT '',
`version_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`repo_url` varchar(100) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '0',
`error_msg` longtext NOT NULL,
`agent_id` int(11) NOT NULL DEFAULT '0' COMMENT '跳板机ID',
`ignore_list` longtext NOT NULL,
`before_shell` longtext NOT NULL,
`after_shell` longtext NOT NULL,
`create_verfile` int(11) NOT NULL DEFAULT '0',
`verfile_path` varchar(50) NOT NULL DEFAULT '',
`task_review` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发布是否需要审批',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_name` varchar(20) NOT NULL DEFAULT '',
`project_ids` varchar(1000) NOT NULL DEFAULT '',
`description` varchar(200) NOT NULL DEFAULT '',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_role_perm` (
`role_id` int(11) unsigned NOT NULL,
`perm` varchar(50) NOT NULL DEFAULT '',
PRIMARY KEY (`role_id`,`perm`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_server` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type_id` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:普通服务器, 1:跳板机',
`ip` varchar(20) NOT NULL DEFAULT '' COMMENT '服务器IP',
`area` varchar(20) NOT NULL DEFAULT '' COMMENT '机房',
`description` varchar(200) NOT NULL DEFAULT '' COMMENT '描述',
`ssh_port` int(11) NOT NULL COMMENT 'ssh端口',
`ssh_user` varchar(50) NOT NULL DEFAULT '' COMMENT 'ssh帐号',
`ssh_pwd` varchar(100) NOT NULL DEFAULT '' COMMENT 'ssh密码',
`ssh_key` varchar(100) NOT NULL DEFAULT '' COMMENT 'sshkey路径',
`work_dir` varchar(100) NOT NULL DEFAULT '' COMMENT '工作目录',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`project_id` int(11) NOT NULL DEFAULT '0' COMMENT '项目ID',
`start_ver` varchar(20) NOT NULL DEFAULT '' COMMENT '起始版本',
`end_ver` varchar(20) NOT NULL DEFAULT '' COMMENT '结束版本',
`message` longtext NOT NULL COMMENT '版本内容',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '提单人ID',
`user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '提单人',
`build_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '构建状态',
`change_logs` longtext NOT NULL COMMENT '修改日志',
`change_files` longtext NOT NULL COMMENT '修改文件列表',
`filepath` varchar(200) NOT NULL DEFAULT '' COMMENT '发布包路径',
`pub_env_id` int(11) NOT NULL DEFAULT '0' COMMENT '发布环境ID',
`pub_time` datetime DEFAULT NULL COMMENT '发布时间',
`error_msg` longtext NOT NULL COMMENT '错误消息',
`pub_log` longtext NOT NULL COMMENT '发布日志',
`pub_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发布状态',
`review_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '审批状态',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `t_task_project_id` (`project_id`),
KEY `t_task_user_id` (`user_id`),
KEY `pub_time` (`pub_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_task_review` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`task_id` int(11) NOT NULL COMMENT '任务ID',
`user_id` int(11) NOT NULL COMMENT '审批人ID',
`user_name` varchar(20) NOT NULL DEFAULT '' COMMENT '审批人名称',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '审批结果(1:通过;0:不通过)',
`message` varchar(1000) NOT NULL DEFAULT '' COMMENT '审批说明',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '审批时间',
PRIMARY KEY (`id`),
KEY `task_id` (`task_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(20) NOT NULL DEFAULT '',
`password` varchar(32) NOT NULL DEFAULT '',
`salt` varchar(10) NOT NULL DEFAULT '',
`sex` int(11) NOT NULL DEFAULT '0',
`email` varchar(50) NOT NULL DEFAULT '',
`last_login` datetime DEFAULT NULL,
`last_ip` varchar(15) NOT NULL DEFAULT '',
`status` int(11) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `user_name` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `t_user_role` (
`user_id` int(11) unsigned NOT NULL,
`role_id` int(11) unsigned NOT NULL,
UNIQUE KEY `user_id` (`user_id`,`role_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `t_perm` (`module`, `action`)
VALUES
('agent','add'),
('agent','del'),
('agent','edit'),
('agent','list'),
('agent','projects'),
('env','add'),
('env','del'),
('env','edit'),
('env','list'),
('mailtpl','add'),
('mailtpl','del'),
('mailtpl','edit'),
('mailtpl','list'),
('project','add'),
('project','del'),
('project','edit'),
('project','list'),
('review','detail'),
('review','list'),
('review','review'),
('role','add'),
('role','del'),
('role','edit'),
('role','list'),
('role','perm'),
('server','add'),
('server','del'),
('server','edit'),
('server','list'),
('server','projects'),
('task','create'),
('task','del'),
('task','detail'),
('task','list'),
('task','publish'),
('user','add'),
('user','del'),
('user','edit'),
('user','list');
INSERT INTO `t_role` (`id`, `role_name`, `project_ids`, `description`, `create_time`, `update_time`)
VALUES
(1,'系统管理员','','','2016-05-11 10:33:59','2016-05-11 10:33:59'),
(2,'发版人员','','','2016-05-11 10:34:15','2016-05-11 10:34:15'),
(3,'审批人员','','','2016-05-11 10:34:22','2016-05-11 10:34:22');
INSERT INTO `t_role_perm` (`role_id`, `perm`)
VALUES
(1,'agent.add'),
(1,'agent.del'),
(1,'agent.edit'),
(1,'agent.list'),
(1,'agent.projects'),
(1,'env.add'),
(1,'env.del'),
(1,'env.edit'),
(1,'env.list'),
(1,'mailtpl.add'),
(1,'mailtpl.del'),
(1,'mailtpl.edit'),
(1,'mailtpl.list'),
(1,'project.add'),
(1,'project.del'),
(1,'project.edit'),
(1,'project.list'),
(1,'review.detail'),
(1,'review.list'),
(1,'review.review'),
(1,'role.add'),
(1,'role.del'),
(1,'role.edit'),
(1,'role.list'),
(1,'role.perm'),
(1,'server.add'),
(1,'server.del'),
(1,'server.edit'),
(1,'server.list'),
(1,'server.projects'),
(1,'task.create'),
(1,'task.del'),
(1,'task.detail'),
(1,'task.list'),
(1,'task.publish'),
(1,'user.add'),
(1,'user.del'),
(1,'user.edit'),
(1,'user.list'),
(2,'task.create'),
(2,'task.del'),
(2,'task.detail'),
(2,'task.list'),
(2,'task.publish'),
(3,'review.detail'),
(3,'review.list'),
(3,'review.review');
INSERT INTO `t_user` (`id`, `user_name`, `password`, `salt`, `sex`, `email`, `last_login`, `last_ip`, `status`, `create_time`, `update_time`)
VALUES
(1,'admin','7fef6171469e80d32c0559f88b377245','',1,'[email protected]','2016-05-11 10:33:49','127.0.0.1',0,'0000-00-00 00:00:00','2016-05-11 10:33:49');