V2__metersphere_ddl.sql 15.7 KB
Newer Older
C
flyway  
Captain.B 已提交
1
CREATE TABLE IF NOT EXISTS `file_content` (
C
Captain.B 已提交
2
    `file_id` varchar(64)  NOT NULL COMMENT 'File ID',
C
flyway  
Captain.B 已提交
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
    `file`    longblob COMMENT 'File content',
    PRIMARY KEY (`file_id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `file_metadata` (
    `id`          varchar(64) NOT NULL COMMENT 'File ID',
    `name`        varchar(64) NOT NULL COMMENT 'File name',
    `type`        varchar(64) DEFAULT NULL COMMENT 'File type',
    `size`        bigint(13)  NOT NULL COMMENT 'File size',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `load_test` (
    `id`                     varchar(50) NOT NULL COMMENT 'Test ID',
    `project_id`             varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
    `name`                   varchar(64) NOT NULL COMMENT 'Test name',
    `description`            varchar(255) DEFAULT NULL COMMENT 'Test description',
    `load_configuration`     longtext COMMENT 'Load configuration (JSON format)',
    `advanced_configuration` longtext COMMENT 'Load configuration (JSON format)',
    `schedule`               longtext COMMENT 'Test schedule (cron list)',
    `create_time`            bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time`            bigint(13)  NOT NULL COMMENT 'Update timestamp',
C
Captain.B 已提交
33
    `status`                 varchar(64)  DEFAULT NULL COMMENT 'Test Status Running, Completed, Error, etc.',
C
Captain.B 已提交
34
    `test_resource_pool_id` varchar(50) DEFAULT NULL,
C
flyway  
Captain.B 已提交
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
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `load_test_file` (
    `test_id` varchar(64) DEFAULT NULL,
    `file_id` varchar(64) DEFAULT NULL,
    UNIQUE KEY `load_test_file_unique_key` (`test_id`, `file_id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4 COMMENT ='测试和文件的关联表';

CREATE TABLE IF NOT EXISTS `load_test_report` (
    `id`          varchar(50) NOT NULL COMMENT 'Test report ID',
    `test_id`     varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to',
    `name`        varchar(64) NOT NULL COMMENT 'Test report name',
    `description` varchar(255) DEFAULT NULL COMMENT 'Test report name',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    `status`      varchar(64) NOT NULL COMMENT 'Status of this test run',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

C
Captain.B 已提交
63 64 65
CREATE TABLE IF NOT EXISTS `load_test_report_detail` (
  `report_id` varchar(50) NOT NULL,
  `content` longtext,
C
Captain.B 已提交
66 67 68
  `part` bigint(11) NOT NULL,
  PRIMARY KEY (`report_id`,`part`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
C
Captain.B 已提交
69

C
Captain.B 已提交
70
CREATE TABLE IF NOT EXISTS `load_test_report_log` (
C
Captain.B 已提交
71
  `id` varchar(50)  NOT NULL,
C
Captain.B 已提交
72 73 74
  `report_id` varchar(50)  NOT NULL,
  `resource_id` varchar(50)  DEFAULT NULL,
  `content` longtext ,
C
Captain.B 已提交
75
  `part` bigint(20) DEFAULT NULL,
C
Captain.B 已提交
76
  PRIMARY KEY (`id`),
C
Captain.B 已提交
77
  KEY `load_test_report_log_report_id_resource_name_index` (`report_id`,`resource_id`,`part`)
C
Captain.B 已提交
78
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ;
C
Captain.B 已提交
79

C
tmp  
Captain.B 已提交
80
CREATE TABLE IF NOT EXISTS `load_test_report_result` (
C
Captain.B 已提交
81 82 83 84
  `id` varchar(50)  NOT NULL,
  `report_id` varchar(50)  NOT NULL,
  `report_key` varchar(64)  DEFAULT NULL,
  `report_value` text ,
C
tmp  
Captain.B 已提交
85 86
  PRIMARY KEY (`id`),
  KEY `load_test_report_result_report_id_report_key_index` (`report_id`,`report_key`)
C
Captain.B 已提交
87
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
C
tmp  
Captain.B 已提交
88 89


C
flyway  
Captain.B 已提交
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
CREATE TABLE IF NOT EXISTS `organization` (
    `id`          varchar(50) NOT NULL COMMENT 'Organization ID',
    `name`        varchar(64) NOT NULL COMMENT 'Organization name',
    `description` varchar(255) DEFAULT NULL COMMENT 'Organization description',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `project` (
    `id`           varchar(50) NOT NULL COMMENT 'Project ID',
    `workspace_id` varchar(50) NOT NULL COMMENT 'Workspace ID this project belongs to',
    `name`         varchar(64) NOT NULL COMMENT 'Project name',
    `description`  varchar(255) DEFAULT NULL COMMENT 'Project description',
    `create_time`  bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time`  bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `role` (
    `id`          varchar(50) NOT NULL COMMENT 'Role ID',
    `name`        varchar(64) NOT NULL COMMENT 'Role name',
    `description` varchar(255) DEFAULT NULL COMMENT 'Role description',
    `type`        varchar(50)  DEFAULT NULL COMMENT 'Role type, (system|organization|workspace)',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `system_parameter` (
    `param_key`   varchar(64) CHARACTER SET utf8mb4 NOT NULL COMMENT 'Parameter name',
    `param_value` varchar(255)                               DEFAULT NULL COMMENT 'Parameter value',
    `type`        varchar(100)                      NOT NULL DEFAULT 'text' COMMENT 'Parameter type',
    `sort`        int(5)                                     DEFAULT NULL COMMENT 'Sort',
    PRIMARY KEY (`param_key`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `test_resource` (
    `id`                    varchar(50) NOT NULL COMMENT 'Test resource ID',
C
Captain.B 已提交
141
    `test_resource_pool_id` varchar(50)  NOT NULL COMMENT 'Test resource pool ID this test resource belongs to',
C
flyway  
Captain.B 已提交
142 143 144 145 146 147 148 149 150 151 152 153 154
    `configuration`         longtext COMMENT 'Test resource configuration',
    `status`                varchar(64) NOT NULL COMMENT 'Test resource status',
    `create_time`           bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time`           bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `test_resource_pool` (
    `id`          varchar(50) NOT NULL COMMENT 'Test resource pool ID',
    `name`        varchar(64) NOT NULL COMMENT 'Test resource pool name',
W
W23123 已提交
155
    `type`        varchar(30) NOT NULL COMMENT 'Test resource pool type',
C
flyway  
Captain.B 已提交
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
    `description` varchar(255) DEFAULT NULL COMMENT 'Test resource pool description',
    `status`      varchar(64) NOT NULL COMMENT 'Test resource pool status',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `user` (
    `id`                   varchar(50) NOT NULL COMMENT 'User ID',
    `name`                 varchar(64) NOT NULL COMMENT 'User name',
    `email`                varchar(64) NOT NULL COMMENT 'E-Mail address',
    `password`             varchar(256) DEFAULT NULL,
    `status`               varchar(50) NOT NULL COMMENT 'User status',
    `create_time`          bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time`          bigint(13)  NOT NULL COMMENT 'Update timestamp',
    `language`             varchar(30)  DEFAULT NULL,
    `last_workspace_id`    varchar(50)  DEFAULT NULL,
    `last_organization_id` varchar(50)  DEFAULT NULL,
    `phone`                varchar(50)  DEFAULT NULL COMMENT 'Phone number of user',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `user_role` (
    `id`          varchar(50) NOT NULL COMMENT 'ID of user''s role info',
    `user_id`     varchar(50) NOT NULL COMMENT 'User ID of this user-role info',
    `role_id`     varchar(50) NOT NULL COMMENT 'Role ID of this user-role info',
    `source_id`   varchar(50) DEFAULT NULL COMMENT 'The (system|organization|workspace) ID of this user-role info',
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `workspace` (
    `id`              varchar(50) NOT NULL COMMENT 'Workspace ID ',
    `organization_id` varchar(50) NOT NULL COMMENT 'Organization ID this workspace belongs to',
    `name`            varchar(64) NOT NULL COMMENT 'Workspace name',
    `description`     varchar(255) DEFAULT NULL COMMENT 'Workspace description',
    `create_time`     bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time`     bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

C
chenjianxing 已提交
210
-- api start
C
chenjianxing 已提交
211

C
chenjianxing 已提交
212
CREATE TABLE IF NOT EXISTS `api_test` (
C
Captain.B 已提交
213 214 215 216 217 218 219
    `id` varchar(50)  NOT NULL COMMENT 'Test ID',
    `project_id` varchar(50)  NOT NULL COMMENT 'Project ID this test belongs to',
    `name` varchar(64)  NOT NULL COMMENT 'Test name',
    `description` varchar(255)  DEFAULT NULL COMMENT 'Test description',
    `scenario_definition` longtext  COMMENT 'Scenario definition (JSON format)',
    `schedule` longtext  COMMENT 'Test schedule (cron list)',
    `status` varchar(64)  DEFAULT NULL,
Q
q4speed 已提交
220 221
    `create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
C
chenjianxing 已提交
222
    PRIMARY KEY (`id`)
Q
q4speed 已提交
223
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
C
chenjianxing 已提交
224

C
chenjianxing 已提交
225
CREATE TABLE IF NOT EXISTS `api_test_file` (
C
chenjianxing 已提交
226 227
    `test_id` varchar(64) DEFAULT NULL,
    `file_id` varchar(64) DEFAULT NULL,
C
chenjianxing 已提交
228
    UNIQUE KEY `api_test_file_unique_key` (`test_id`, `file_id`)
C
chenjianxing 已提交
229 230
)
    ENGINE = InnoDB
C
chenjianxing 已提交
231
    DEFAULT CHARSET = utf8mb4 COMMENT ='Api test test file relevance table';
C
chenjianxing 已提交
232

C
chenjianxing 已提交
233
CREATE TABLE IF NOT EXISTS `api_test_report` (
C
chenjianxing 已提交
234 235 236 237 238 239 240 241 242 243 244 245 246 247
    `id`          varchar(50) NOT NULL COMMENT 'Test report ID',
    `test_id`     varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to',
    `name`        varchar(64) NOT NULL COMMENT 'Test report name',
    `description` varchar(255) DEFAULT NULL COMMENT 'Test report name',
    `content`     longtext,
    `create_time` bigint(13)  NOT NULL COMMENT 'Create timestamp',
    `update_time` bigint(13)  NOT NULL COMMENT 'Update timestamp',
    `status`      varchar(64) NOT NULL COMMENT 'Status of this test run',
    PRIMARY KEY (`id`)
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

C
chenjianxing 已提交
248
-- api end
C
chenjianxing 已提交
249 250 251 252 253 254

-- track start

CREATE TABLE IF NOT EXISTS `test_plan` (
    `id`                     varchar(50) NOT NULL COMMENT 'Test Plan ID',
    `project_id`             varchar(50) NOT NULL COMMENT 'Project ID this plan belongs to',
C
chenjianxing 已提交
255
    `workspace_id`           varchar(50) NOT NULL COMMENT 'Workspace ID this plan belongs to',
C
uuid  
chenjianxing 已提交
256
    `report_id`              varchar(50) COMMENT 'Test plan report',
C
chenjianxing 已提交
257 258 259
    `name`                   varchar(64) NOT NULL COMMENT 'Plan name',
    `description`            varchar(255) DEFAULT NULL COMMENT 'Plan description',
    `status`                 varchar(20) NOT NULL COMMENT 'Plan status',
C
chenjianxing 已提交
260 261
    `stage`                  varchar(30) NOT NULL COMMENT 'Plan stage',
    `principal`              varchar(50) NOT NULL COMMENT 'Plan principal',
C
chenjianxing 已提交
262 263 264 265
    `test_case_match_rule`   varchar(255) DEFAULT NULL COMMENT 'Test case match rule',
    `executor_match_rule`    varchar(255) DEFAULT NULL  COMMENT 'Executor match rule)',
    `tags`                   text COMMENT 'Test plan tags (JSON format)',
    `create_time`            bigint(13)  NOT NULL COMMENT 'Create timestamp',
王振 已提交
266
    `update_time`            bigint(13)  NOT NULL COMMENT 'Update timestamp',
C
chenjianxing 已提交
267
    PRIMARY KEY (`id`)
C
chenjianxing 已提交
268 269 270 271 272 273 274
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;


CREATE TABLE IF NOT EXISTS `test_case_node` (
C
uuid  
chenjianxing 已提交
275
    `id`                     varchar(50) NOT NULL COMMENT 'Test case node ID',
C
chenjianxing 已提交
276 277
    `project_id`             varchar(50) NOT NULL COMMENT 'Project ID this node belongs to',
    `name`                   varchar(64) NOT NULL COMMENT 'Node name',
C
uuid  
chenjianxing 已提交
278
    `parent_id`              varchar(50) DEFAULT NULL COMMENT 'Parent node ID',
C
chenjianxing 已提交
279 280
    `level`                  int(10)  DEFAULT 1 COMMENT 'Node level',
    `create_time`            bigint(13)  NOT NULL COMMENT 'Create timestamp',
C
uuid  
chenjianxing 已提交
281 282
    `update_time`            bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
C
chenjianxing 已提交
283 284 285 286 287 288 289 290
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;


CREATE TABLE IF NOT EXISTS `test_case` (
    `id`                     varchar(50) NOT NULL COMMENT 'Test case ID',
C
uuid  
chenjianxing 已提交
291
    `node_id`                varchar(50) NOT NULL COMMENT 'Node ID this case belongs to',
C
chenjianxing 已提交
292
    `node_path`              varchar(50) NOT NULL COMMENT 'Node path this case belongs to',
C
chenjianxing 已提交
293 294 295 296 297 298 299 300 301 302
    `project_id`             varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
    `name`                   varchar(64) NOT NULL COMMENT 'Case name',
    `type`                   varchar(25) NOT NULL COMMENT 'Test case type',
    `maintainer`             varchar(25) NOT NULL COMMENT 'Test case maintainer',
    `priority`               varchar(50) NOT NULL COMMENT 'Test case priority',
    `method`                 varchar(15) NOT NULL COMMENT 'Test case method type',
    `prerequisite`           varchar(255) DEFAULT NULL COMMENT 'Test case prerequisite condition',
    `remark`                 text DEFAULT NULL COMMENT 'Test case remark',
    `steps`                  text DEFAULT NULL COMMENT 'Test case steps (JSON format)',
    `create_time`            bigint(13)  NOT NULL COMMENT 'Create timestamp',
王振 已提交
303 304
    `update_time`            bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
C
chenjianxing 已提交
305 306 307 308 309 310 311
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;


CREATE TABLE IF NOT EXISTS `test_plan_test_case` (
C
uuid  
chenjianxing 已提交
312
    `id`                     varchar(50) NOT NULL COMMENT 'ID',
C
chenjianxing 已提交
313 314 315 316 317
    `plan_id`                varchar(50) NOT NULL COMMENT 'Plan ID relation to',
    `case_id`                varchar(50) NOT NULL COMMENT 'Case ID relation to',
    `executor`               varchar(64) NOT NULL COMMENT 'Test case executor',
    `status`                 varchar(15) NULL COMMENT 'Test case status',
    `results`                longtext COMMENT 'Test case result',
C
chenjianxing 已提交
318
    `issues`                 longtext COMMENT 'Test case result issues',
C
chenjianxing 已提交
319 320
    `remark`                 varchar(255) DEFAULT NULL COMMENT 'Test case remark',
    `create_time`            bigint(13)  NOT NULL COMMENT 'Create timestamp',
C
uuid  
chenjianxing 已提交
321 322
    `update_time`            bigint(13)  NOT NULL COMMENT 'Update timestamp',
    PRIMARY KEY (`id`)
C
chenjianxing 已提交
323 324 325 326 327
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_bin;

C
chenjianxing 已提交
328
CREATE TABLE IF NOT EXISTS `test_case_report_template` (
C
uuid  
chenjianxing 已提交
329 330
  `id`           varchar(50) NOT NULL,
  `name`         varchar(64) NOT NULL COMMENT 'Test case report template name',
C
chenjianxing 已提交
331
  `workspace_id` varchar(50) DEFAULT NULL COMMENT 'Workspace ID this project belongs to',
C
uuid  
chenjianxing 已提交
332
  `content`      longtext COMMENT 'Template content (JSON format)',
C
chenjianxing 已提交
333 334 335 336 337 338 339
  PRIMARY KEY (`id`)
)
    ENGINE=InnoDB
    DEFAULT CHARSET=utf8mb4
    COLLATE=utf8mb4_bin;

CREATE TABLE IF NOT EXISTS `test_case_report` (
C
uuid  
chenjianxing 已提交
340 341 342 343 344
  `id`             varchar(50) NOT NULL,
  `name`           varchar(64) NOT NULL COMMENT 'Test case report name',
  `content`        longtext COMMENT 'Report content (JSON format)',
  `start_time`     bigint(13)  COMMENT 'Test start time',
  `end_time`       bigint(13) COMMENT 'Test end time',
C
chenjianxing 已提交
345 346 347 348 349 350
  PRIMARY KEY (`id`)
)
    ENGINE=InnoDB
    DEFAULT CHARSET=utf8mb4
    COLLATE=utf8mb4_bin;

C
chenjianxing 已提交
351
-- track end
C
chenjianxing 已提交
352 353 354