-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Controller] genesis vinterface add team id
- Loading branch information
1 parent
3556c60
commit f2cb002
Showing
13 changed files
with
122 additions
and
55 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
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
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
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
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
server/controller/db/mysql/migration/rawsql/issu/6.5.1.35.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 @@ | ||
-- modify start, add upgrade sql | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
|
||
CREATE PROCEDURE AddColumnIfNotExists( | ||
IN tableName VARCHAR(255), | ||
IN colName VARCHAR(255), | ||
IN afterCol VARCHAR(255) | ||
) | ||
BEGIN | ||
DECLARE column_count INT; | ||
|
||
-- 检查列是否存在 | ||
SELECT COUNT(*) | ||
INTO column_count | ||
FROM information_schema.columns | ||
WHERE TABLE_SCHEMA = DATABASE() | ||
AND TABLE_NAME = tableName | ||
AND column_name = colName; | ||
|
||
-- 如果列不存在,则添加列 | ||
IF column_count = 0 THEN | ||
SET @sql = CONCAT('ALTER TABLE ', tableName, ' ADD COLUMN ', colName, ' INTEGER DEFAULT 1 AFTER ', afterCol); | ||
PREPARE stmt FROM @sql; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL AddColumnIfNotExists('genesis_vinterface', 'team_id', 'kubernetes_cluster_id'); | ||
|
||
DROP PROCEDURE AddColumnIfNotExists; | ||
|
||
-- update db_version to latest, remeber update DB_VERSION_EXPECT in migrate/init.go | ||
UPDATE db_version SET version='6.5.1.35'; | ||
-- modify end |
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
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
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
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
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
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
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