table_init.sql 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. create table if not exists devcloud.func_test_case
  2. (
  3. id int auto_increment
  4. primary key,
  5. project_id int not null,
  6. title varchar(63) null,
  7. pass tinyint(1) default 0 not null
  8. ) DEFAULT CHARSET=utf8;
  9. create table if not exists devcloud.func_test_record
  10. (
  11. id int auto_increment
  12. primary key,
  13. timestamp timestamp default CURRENT_TIMESTAMP not null,
  14. operation_type varchar(15) null,
  15. pipeline_record_id int null
  16. ) DEFAULT CHARSET=utf8;
  17. create table if not exists devcloud.func_test_step
  18. (
  19. id int auto_increment
  20. primary key,
  21. test_case_id int null,
  22. description text null,
  23. expectation text null,
  24. state varchar(11) null,
  25. constraint test_step_test_case_id_fk
  26. foreign key (test_case_id) references devcloud.func_test_case (id)
  27. on delete set null
  28. ) DEFAULT CHARSET=utf8;
  29. create table if not exists devcloud.project
  30. (
  31. id int not null
  32. primary key,
  33. name varchar(128) null,
  34. description varchar(512) null,
  35. git_remote_url varchar(512) not null,
  36. constraint project_name_uindex
  37. unique (name)
  38. )
  39. charset = utf8;
  40. create table if not exists devcloud.commit
  41. (
  42. id varchar(127) not null
  43. primary key,
  44. message text null,
  45. title text null,
  46. timestamp varchar(31) null,
  47. gitlab_username varchar(31) null,
  48. related_id int null,
  49. project_id int null,
  50. related_type varchar(11) null,
  51. email varchar(63) null,
  52. constraint commit_project_id_fk
  53. foreign key (project_id) references devcloud.project (id)
  54. ) DEFAULT CHARSET=utf8;
  55. create table if not exists devcloud.pipeline
  56. (
  57. id int auto_increment
  58. primary key,
  59. project_id int null,
  60. name varchar(47) null,
  61. config_json text null,
  62. template_name varchar(31) null,
  63. constraint pipeline_project_id_fk
  64. foreign key (project_id) references devcloud.project (id)
  65. on delete set null
  66. ) DEFAULT CHARSET=utf8;
  67. create table if not exists devcloud.deployment
  68. (
  69. id int auto_increment
  70. primary key,
  71. pipeline_id int not null,
  72. namespace varchar(63) null,
  73. deploy_name varchar(63) null,
  74. deployed_time timestamp null,
  75. access_url text null,
  76. constraint deployment_pipeline_id_uindex
  77. unique (pipeline_id),
  78. constraint deployment_pipeline_id_fk
  79. foreign key (pipeline_id) references devcloud.pipeline (id)
  80. ) DEFAULT CHARSET=utf8;
  81. create table if not exists devcloud.project_related
  82. (
  83. id int auto_increment
  84. primary key,
  85. project_id_a int null,
  86. project_id_b int null,
  87. constraint project_related_project_id_fk
  88. foreign key (project_id_a) references devcloud.project (id)
  89. on delete cascade,
  90. constraint project_related_project_id_fk_2
  91. foreign key (project_id_b) references devcloud.project (id)
  92. on delete cascade
  93. ) DEFAULT CHARSET=utf8;
  94. create table if not exists devcloud.stage
  95. (
  96. id int auto_increment
  97. primary key,
  98. title varchar(31) null,
  99. description text null,
  100. name varchar(63) null,
  101. skippable tinyint(1) default 0 not null
  102. ) DEFAULT CHARSET=utf8;
  103. create table if not exists devcloud.stage_config
  104. (
  105. id int auto_increment
  106. primary key,
  107. name varchar(63) null,
  108. value text null,
  109. editable tinyint(1) null,
  110. stage_id int null,
  111. constraint stage_config_stage_id_fk
  112. foreign key (stage_id) references devcloud.stage (id)
  113. ) DEFAULT CHARSET=utf8;
  114. create table if not exists devcloud.test_info
  115. (
  116. test_id int auto_increment
  117. primary key,
  118. test_name varchar(255) not null,
  119. project_id int not null,
  120. username varchar(255) not null,
  121. create_time datetime not null,
  122. url varchar(255) not null,
  123. params json null,
  124. qps int not null,
  125. method varchar(255) not null
  126. ) DEFAULT CHARSET=utf8;
  127. create table if not exists devcloud.test_result
  128. (
  129. id int auto_increment
  130. primary key,
  131. test_id int not null,
  132. execute_time datetime not null,
  133. success int default 0 not null,
  134. failure int default 0 not null,
  135. time_list text not null,
  136. max_time int not null,
  137. min_time int not null,
  138. average_time double not null,
  139. pipeline_record_id int null
  140. ) DEFAULT CHARSET=utf8;
  141. create table if not exists devcloud.tree_node
  142. (
  143. id int auto_increment
  144. primary key,
  145. title varchar(24) not null,
  146. description varchar(512) null,
  147. type varchar(32) default '0' not null,
  148. priority varchar(32) default '0' null,
  149. state varchar(32) default '0' not null,
  150. time_to_take int default 0 not null,
  151. start_time datetime default CURRENT_TIMESTAMP not null,
  152. end_time datetime null,
  153. leaf tinyint(1) default 0 null,
  154. project_id int null,
  155. deep int null,
  156. parent_id int null,
  157. processor_id int null
  158. ) DEFAULT CHARSET=utf8;
  159. create table if not exists devcloud.user
  160. (
  161. id int not null
  162. primary key,
  163. username varchar(31) null,
  164. phone varchar(11) null,
  165. email varchar(63) null,
  166. role varchar(11) null,
  167. with_gitlab tinyint(1) null
  168. ) DEFAULT CHARSET=utf8;
  169. create table if not exists devcloud.bug_list
  170. (
  171. id int auto_increment
  172. primary key,
  173. title varchar(31) null,
  174. description text null,
  175. time_to_take mediumtext null,
  176. start_time timestamp default CURRENT_TIMESTAMP not null,
  177. end_time timestamp null,
  178. priority varchar(10) null,
  179. state varchar(10) null,
  180. project_id int null,
  181. processor_id int null,
  182. constraint bug_list_project_id_fk
  183. foreign key (project_id) references devcloud.project (id),
  184. constraint bug_list_user_id_fk
  185. foreign key (processor_id) references devcloud.user (id)
  186. ) DEFAULT CHARSET=utf8;
  187. create table if not exists devcloud.pipeline_record
  188. (
  189. id int auto_increment
  190. primary key,
  191. pipeline_id int null,
  192. start_time timestamp default CURRENT_TIMESTAMP not null,
  193. user_id int null,
  194. result varchar(15) null,
  195. details longtext null,
  196. constraint pipeline_record_pipeline_id_fk
  197. foreign key (pipeline_id) references devcloud.pipeline (id),
  198. constraint pipeline_record_user_id_fk
  199. foreign key (user_id) references devcloud.user (id)
  200. ) DEFAULT CHARSET=utf8;