From 05a8fc5695f08db888871cbc545cdab523e8dfb0 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 6 Apr 2022 19:37:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20fl?= =?UTF-8?q?yway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --- .../db/migration/V112__v1.19.2_release.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/src/main/resources/db/migration/V112__v1.19.2_release.sql b/backend/src/main/resources/db/migration/V112__v1.19.2_release.sql index fb6b8154e0..acbd58c6ac 100644 --- a/backend/src/main/resources/db/migration/V112__v1.19.2_release.sql +++ b/backend/src/main/resources/db/migration/V112__v1.19.2_release.sql @@ -1,2 +1,17 @@ + ALTER TABLE test_plan MODIFY name VARCHAR(128) NOT NULL COMMENT 'Plan name'; + +DROP PROCEDURE IF EXISTS schema_change_api; +DELIMITER // +CREATE PROCEDURE schema_change_api() BEGIN + DECLARE CurrentDatabase VARCHAR(100); + SELECT DATABASE() INTO CurrentDatabase; + IF NOT EXISTS (SELECT * FROM information_schema.statistics WHERE table_schema=CurrentDatabase AND table_name = 'test_plan_test_case' AND index_name = 'plan_id_index') THEN + ALTER TABLE `test_plan_test_case` ADD INDEX plan_id_index ( `plan_id` ); + END IF; +END// +DELIMITER ; +CALL schema_change_api(); + +