Skip to content

Commit

Permalink
feat: modifies vtap_type field default value
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengYa-0110 committed Jan 22, 2025
1 parent 7f5faff commit 95aa4da
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ CREATE TABLE IF NOT EXISTS npb_policy (
payload_slice INTEGER DEFAULT NULL,
acl_id INTEGER,
policy_acl_group_id INTEGER,
vtap_type TINYINT(1) DEFAULT 0 COMMENT '1-vtap; 2-vtap_group',
vtap_type TINYINT(1) COMMENT '1-vtap; 2-vtap_group',
vtap_ids TEXT COMMENT 'separated by ,',
vtap_group_ids TEXT COMMENT 'separated by ,',
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -1093,7 +1093,7 @@ CREATE TABLE IF NOT EXISTS pcap_policy (
state INTEGER DEFAULT 1 COMMENT '0-disable; 1-enable',
business_id INTEGER NOT NULL,
acl_id INTEGER,
vtap_type TINYINT(1) DEFAULT 0 COMMENT '1-vtap; 2-vtap_group',
vtap_type TINYINT(1) COMMENT '1-vtap; 2-vtap_group',
vtap_ids TEXT COMMENT 'separated by ,',
vtap_group_ids TEXT COMMENT 'separated by ,',
payload_slice INTEGER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN
END IF;
END;

CALL AddColumnIfNotExists('npb_policy', 'vtap_type', "TINYINT(1) DEFAULT 0 COMMENT '1-vtap; 2-vtap_group'", 'policy_acl_group_id');
CALL AddColumnIfNotExists('npb_policy', 'vtap_type', "TINYINT(1) COMMENT '1-vtap; 2-vtap_group'", 'policy_acl_group_id');
CALL AddColumnIfNotExists('npb_policy', 'vtap_group_ids', "TEXT COMMENT 'separated by ,'", 'vtap_ids');

DROP PROCEDURE AddColumnIfNotExists;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BEGIN
END IF;
END;

CALL AddColumnIfNotExists('pcap_policy', 'vtap_type', "TINYINT(1) DEFAULT 0 COMMENT '1-vtap; 2-vtap_group'", 'acl_id');
CALL AddColumnIfNotExists('pcap_policy', 'vtap_type', "TINYINT(1) COMMENT '1-vtap; 2-vtap_group'", 'acl_id');
CALL AddColumnIfNotExists('pcap_policy', 'vtap_group_ids', "TEXT COMMENT 'separated by ,'", 'vtap_ids');

DROP PROCEDURE AddColumnIfNotExists;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ CREATE TABLE IF NOT EXISTS npb_policy (
payload_slice INTEGER DEFAULT NULL,
acl_id INTEGER,
policy_acl_group_id INTEGER,
vtap_type SMALLINT DEFAULT 0,
vtap_type SMALLINT,
vtap_ids TEXT,
vtap_group_ids TEXT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Expand Down Expand Up @@ -1708,7 +1708,7 @@ CREATE TABLE IF NOT EXISTS pcap_policy (
state INTEGER DEFAULT 1,
business_id INTEGER NOT NULL,
acl_id INTEGER,
vtap_type SMALLINT DEFAULT 0,
vtap_type SMALLINT,
vtap_ids TEXT,
vtap_group_ids TEXT,
payload_slice INTEGER,
Expand Down
12 changes: 6 additions & 6 deletions server/controller/db/metadb/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ type NpbPolicy struct {
PayloadSlice *int `gorm:"column:payload_slice;type:int;default:null" json:"PAYLOAD_SLICE"`
ACLID int `gorm:"column:acl_id;type:int;default:null" json:"ACL_ID"`
PolicyACLGroupID int `gorm:"column:policy_acl_group_id;type:int;default:null" json:"POLICY_ACL_GROUP_ID"`
VtapType int `gorm:"column:vtap_type;type:type:tinyint(1);default:0" json:"VTAP_TYPE"` // 1-vtap; 2-vtap_group
VtapIDs string `gorm:"column:vtap_ids;type:text" json:"VTAP_IDS"` // separated by ,
VtapGroupIDs string `gorm:"column:vtap_group_ids;type:text" json:"VTAP_GROUP_IDS"` // separated by ,
VtapType int `gorm:"column:vtap_type;type:type:tinyint(1);default:null" json:"VTAP_TYPE"` // 1-vtap; 2-vtap_group
VtapIDs string `gorm:"column:vtap_ids;type:text" json:"VTAP_IDS"` // separated by ,
VtapGroupIDs string `gorm:"column:vtap_group_ids;type:text" json:"VTAP_GROUP_IDS"` // separated by ,
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"CREATED_AT"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"UPDATED_AT"`
Lcuuid string `gorm:"column:lcuuid;type:char(64);default:null" json:"LCUUID"`
Expand Down Expand Up @@ -394,9 +394,9 @@ type PcapPolicy struct {
State int `gorm:"column:state;type:int;default:0" json:"STATE"` // 0-disable; 1-enable
BusinessID int `gorm:"column:business_id;type:int;not null" json:"BUSINESS_ID"`
ACLID int `gorm:"column:acl_id;type:int;default:null" json:"ACL_ID"`
VtapType int `gorm:"column:vtap_type;type:type:tinyint(1);default:0" json:"VTAP_TYPE"` // 1-vtap; 2-vtap_group
VtapIDs string `gorm:"column:vtap_ids;type:text;default:null" json:"VTAP_IDS"` // separated by ,
VtapGroupIDs string `gorm:"column:vtap_group_ids;type:text;default:null" json:"VTAP_GROUP_IDS"` // separated by ,
VtapType int `gorm:"column:vtap_type;type:type:tinyint(1);default:null" json:"VTAP_TYPE"` // 1-vtap; 2-vtap_group
VtapIDs string `gorm:"column:vtap_ids;type:text;default:null" json:"VTAP_IDS"` // separated by ,
VtapGroupIDs string `gorm:"column:vtap_group_ids;type:text;default:null" json:"VTAP_GROUP_IDS"` // separated by ,
PayloadSlice *int `gorm:"column:payload_slice;type:int;default:null" json:"PAYLOAD_SLICE"`
PolicyACLGroupID int `gorm:"column:policy_acl_group_id;type:int;default:null" json:"POLICY_ACL_GROUP_ID"`
UserID int `gorm:"column:user_id;type:int;default:null" json:"USER_ID"`
Expand Down

0 comments on commit 95aa4da

Please sign in to comment.