-
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.
Merge branch 'main' into support_pcap_compress
- Loading branch information
Showing
8 changed files
with
156 additions
and
36 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
30 changes: 30 additions & 0 deletions
30
server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.3.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,30 @@ | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
|
||
CREATE PROCEDURE AddColumnIfNotExists( | ||
IN tableName VARCHAR(255), | ||
IN colName VARCHAR(255), | ||
IN colType 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, ' ', colType, ' AFTER ', afterCol); | ||
PREPARE stmt FROM @sql; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL AddColumnIfNotExists('npb_policy', 'vtap_type', "TINYINT(1) DEFAULT 1 COMMENT '1: vtap; 2: vtap_group'", 'policy_acl_group_id'); | ||
CALL AddColumnIfNotExists('npb_policy', 'vtap_group_ids', "TEXT COMMENT 'separated by ,'", 'vtap_ids'); | ||
|
||
UPDATE db_version SET version='7.0.1.3'; |
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