1
0

table_init.sql 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. );
  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. );
  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. );
  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. );
  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. );
  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. );
  81. create table if not exists devcloud.stage
  82. (
  83. id int auto_increment
  84. primary key,
  85. title varchar(31) null,
  86. description text null,
  87. name varchar(63) null,
  88. skippable tinyint(1) default 0 not null
  89. );
  90. create table if not exists devcloud.stage_config
  91. (
  92. id int auto_increment
  93. primary key,
  94. name varchar(63) null,
  95. value text null,
  96. editable tinyint(1) null,
  97. stage_id int null,
  98. constraint stage_config_stage_id_fk
  99. foreign key (stage_id) references devcloud.stage (id)
  100. );
  101. create table if not exists devcloud.test_info
  102. (
  103. test_id int auto_increment
  104. primary key,
  105. test_name varchar(255) not null,
  106. project_id int not null,
  107. username varchar(255) not null,
  108. create_time datetime not null,
  109. url varchar(255) not null,
  110. params json null,
  111. qps int not null,
  112. method varchar(255) not null
  113. );
  114. create table if not exists devcloud.test_result
  115. (
  116. id int auto_increment
  117. primary key,
  118. test_id int not null,
  119. execute_time datetime not null,
  120. success int default 0 not null,
  121. failure int default 0 not null,
  122. time_list text not null,
  123. max_time int not null,
  124. min_time int not null,
  125. average_time double not null,
  126. pipeline_record_id int null
  127. );
  128. create table if not exists devcloud.tree_node
  129. (
  130. id int auto_increment
  131. primary key,
  132. title varchar(24) not null,
  133. description varchar(512) null,
  134. type varchar(32) default '0' not null,
  135. priority varchar(32) default '0' null,
  136. state varchar(32) default '0' not null,
  137. time_to_take int default 0 not null,
  138. start_time datetime default CURRENT_TIMESTAMP not null,
  139. end_time datetime null,
  140. leaf tinyint(1) default 0 null,
  141. project_id int null,
  142. deep int null,
  143. parent_id int null,
  144. processor_id int null
  145. );
  146. create table if not exists devcloud.user
  147. (
  148. id int not null
  149. primary key,
  150. username varchar(31) null,
  151. phone varchar(11) null,
  152. email varchar(63) null,
  153. role varchar(11) null,
  154. with_gitlab tinyint(1) null
  155. );
  156. create table if not exists devcloud.bug_list
  157. (
  158. id int auto_increment
  159. primary key,
  160. title varchar(31) null,
  161. description text null,
  162. time_to_take mediumtext null,
  163. start_time timestamp default CURRENT_TIMESTAMP not null,
  164. end_time timestamp null,
  165. priority varchar(10) null,
  166. state varchar(10) null,
  167. project_id int null,
  168. processor_id int null,
  169. constraint bug_list_project_id_fk
  170. foreign key (project_id) references devcloud.project (id),
  171. constraint bug_list_user_id_fk
  172. foreign key (processor_id) references devcloud.user (id)
  173. );
  174. create table if not exists devcloud.pipeline_record
  175. (
  176. id int auto_increment
  177. primary key,
  178. pipeline_id int null,
  179. start_time timestamp default CURRENT_TIMESTAMP not null,
  180. user_id int null,
  181. result varchar(15) null,
  182. details longtext null,
  183. constraint pipeline_record_pipeline_id_fk
  184. foreign key (pipeline_id) references devcloud.pipeline (id),
  185. constraint pipeline_record_user_id_fk
  186. foreign key (user_id) references devcloud.user (id)
  187. );