refactor(接口测试): 增加接口和场景的索引

--bug=1025028 --user=王孝刚 【接口测试】场景-删除模块-模块下只有一个场景-耗时20秒左右
https://www.tapd.cn/55049933/s/1358738
This commit is contained in:
wxg0103 2023-04-03 17:43:20 +08:00 committed by fit2-zhao
parent 60cf19b2f9
commit 47a796f296
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,17 @@
SET SESSION innodb_lock_wait_timeout = 7200;
--
-- 增加一个索引
SELECT IF(EXISTS(SELECT DISTINCT index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'api_scenario'
AND index_name LIKE 'api_scenario_module_id_index'),
'select 1',
'ALTER TABLE api_scenario ADD INDEX api_scenario_module_id_index (api_scenario_module_id)')
INTO @a;
PREPARE moduleId FROM @a;
EXECUTE moduleId;
DEALLOCATE PREPARE moduleId;
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -0,0 +1,17 @@
SET SESSION innodb_lock_wait_timeout = 7200;
--
-- 增加一个索引
SELECT IF(EXISTS(SELECT DISTINCT index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'api_definition'
AND index_name LIKE 'api_definition_protocol_index'),
'select 1',
'ALTER TABLE api_definition ADD INDEX api_definition_protocol_index (protocol)')
INTO @a;
PREPARE protocol FROM @a;
EXECUTE protocol;
DEALLOCATE PREPARE protocol;
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -0,0 +1,17 @@
SET SESSION innodb_lock_wait_timeout = 7200;
--
-- 增加一个索引
SELECT IF(EXISTS(SELECT DISTINCT index_name
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'api_test_case'
AND index_name LIKE 'api_test_case_project_id_index'),
'select 1',
'ALTER TABLE api_test_case ADD INDEX api_test_case_project_id_index (project_id)')
INTO @a;
PREPARE projectId FROM @a;
EXECUTE projectId;
DEALLOCATE PREPARE projectId;
SET SESSION innodb_lock_wait_timeout = DEFAULT;