-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
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
45 changes: 45 additions & 0 deletions
45
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,45 @@ | ||
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 NOT EXISTS(SELECT 1 | ||
FROM information_schema.COLUMNS | ||
WHERE TABLE_SCHEMA = db | ||
AND TABLE_NAME = 'T_REPOSITORY_GIT_TOKEN' | ||
AND COLUMN_NAME = 'UPDATE_TIME') THEN | ||
ALTER TABLE T_REPOSITORY_GIT_TOKEN | ||
ADD COLUMN `UPDATE_TIME` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间'; | ||
END IF; | ||
|
||
IF NOT EXISTS(SELECT 1 | ||
FROM information_schema.COLUMNS | ||
WHERE TABLE_SCHEMA = db | ||
AND TABLE_NAME = 'T_REPOSITORY_GIT_TOKEN' | ||
AND COLUMN_NAME = 'OPERATOR') THEN | ||
ALTER TABLE T_REPOSITORY_GIT_TOKEN | ||
ADD COLUMN `OPERATOR` varchar(64) DEFAULT NULL COMMENT '操作人'; | ||
END IF; | ||
|
||
IF NOT EXISTS(SELECT 1 | ||
FROM information_schema.COLUMNS | ||
WHERE TABLE_SCHEMA = db | ||
AND TABLE_NAME = 'T_REPOSITORY_GITHUB_TOKEN' | ||
AND COLUMN_NAME = 'OPERATOR') THEN | ||
ALTER TABLE T_REPOSITORY_GITHUB_TOKEN | ||
ADD COLUMN `OPERATOR` varchar(64) DEFAULT NULL COMMENT '操作人'; | ||
END IF; | ||
|
||
COMMIT; | ||
END <CI_UBF> | ||
DELIMITER ; | ||
COMMIT; | ||
CALL ci_repository_schema_update(); |