From 5f46dda7b7569be364df90198e5ffd6ec061ea98 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 21 Apr 2023 15:24:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96test=5Fcase=5Fnod?= =?UTF-8?q?e=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ddl/V138__modify_case_node_index.sql | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 system-setting/backend/src/main/resources/db/migration/2.9.0/ddl/V138__modify_case_node_index.sql diff --git a/system-setting/backend/src/main/resources/db/migration/2.9.0/ddl/V138__modify_case_node_index.sql b/system-setting/backend/src/main/resources/db/migration/2.9.0/ddl/V138__modify_case_node_index.sql new file mode 100644 index 0000000000..6392a32270 --- /dev/null +++ b/system-setting/backend/src/main/resources/db/migration/2.9.0/ddl/V138__modify_case_node_index.sql @@ -0,0 +1,40 @@ +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 = 'test_case_node' + AND index_name LIKE 'test_case_node_parent_id_index'), + 'select 1', + 'ALTER TABLE test_case_node ADD INDEX test_case_node_parent_id_index (parent_id)') +INTO @a; +PREPARE stmt1 FROM @a; +EXECUTE stmt1; +DEALLOCATE PREPARE stmt1; + +SELECT IF(EXISTS(SELECT DISTINCT index_name + FROM information_schema.statistics + WHERE table_schema = DATABASE() + AND table_name = 'test_case_node' + AND index_name LIKE 'test_case_node_name_index'), + 'select 1', + 'ALTER TABLE test_case_node ADD INDEX test_case_node_name_index (name)') +INTO @a; +PREPARE stmt1 FROM @a; +EXECUTE stmt1; +DEALLOCATE PREPARE stmt1; + +SELECT IF(EXISTS(SELECT DISTINCT index_name + FROM information_schema.statistics + WHERE table_schema = DATABASE() + AND table_name = 'test_case_node' + AND index_name LIKE 'test_case_node_level_index'), + 'select 1', + 'ALTER TABLE test_case_node ADD INDEX test_case_node_level_index (level)') +INTO @a; +PREPARE stmt1 FROM @a; +EXECUTE stmt1; +DEALLOCATE PREPARE stmt1; + +SET SESSION innodb_lock_wait_timeout = DEFAULT; \ No newline at end of file