forked from TencentBlueKing/bk-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: copilot 编辑器支持免登录 TencentBlueKing#11290 补充SQL
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
support-files/sql/2004_v3.x/2030_ci_repository-update_v3.0_mysql.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
USE devops_ci_repository; | ||
SET NAMES utf8mb4; | ||
|
||
DROP PROCEDURE IF EXISTS ci_repository_schema_update; | ||
|
||
DELIMITER <CI_UBF> | ||
|
||
CREATE PROCEDURE ci_repository_schema_update() | ||
BEGIN | ||
DECLARE db VARCHAR(100); | ||
SET AUTOCOMMIT = 0; | ||
SELECT DATABASE() INTO db; | ||
|
||
|
||
IF EXISTS(SELECT 1 | ||
FROM information_schema.statistics | ||
WHERE TABLE_SCHEMA = db | ||
AND TABLE_NAME = 'T_REPOSITORY_GIT_TOKEN' | ||
AND INDEX_NAME = 'USER_ID') THEN | ||
ALTER TABLE T_REPOSITORY_GIT_TOKEN DROP INDEX `USER_ID`; | ||
END IF; | ||
|
||
IF NOT EXISTS(SELECT 1 | ||
FROM information_schema.statistics | ||
WHERE TABLE_SCHEMA = db | ||
AND TABLE_NAME = 'T_REPOSITORY_GIT_TOKEN' | ||
AND INDEX_NAME = 'T_REPOSITORY_GIT_TOKEN_UNIQUE') THEN | ||
ALTER TABLE T_REPOSITORY_GIT_TOKEN ADD INDEX `T_REPOSITORY_GIT_TOKEN_UNIQUE` (`USER_ID`,`TOKEN_TYPE`); | ||
END IF; | ||
|
||
COMMIT; | ||
END <CI_UBF> | ||
DELIMITER ; | ||
COMMIT; | ||
CALL ci_repository_schema_update(); |