From 95aa4da0ef4b21579114ef64ade830136dd5ebe8 Mon Sep 17 00:00:00 2001 From: zhengya Date: Wed, 22 Jan 2025 15:52:36 +0800 Subject: [PATCH] feat: modifies vtap_type field default value --- .../db/metadb/migrator/schema/rawsql/mysql/init.sql | 4 ++-- .../migrator/schema/rawsql/mysql/issu/7.0.1.3.sql | 2 +- .../migrator/schema/rawsql/mysql/issu/7.0.1.4.sql | 2 +- .../metadb/migrator/schema/rawsql/postgres/init.sql | 4 ++-- server/controller/db/metadb/model/model.go | 12 ++++++------ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/controller/db/metadb/migrator/schema/rawsql/mysql/init.sql b/server/controller/db/metadb/migrator/schema/rawsql/mysql/init.sql index 891e5baee64..f5125ef3f79 100644 --- a/server/controller/db/metadb/migrator/schema/rawsql/mysql/init.sql +++ b/server/controller/db/metadb/migrator/schema/rawsql/mysql/init.sql @@ -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, @@ -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, diff --git a/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.3.sql b/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.3.sql index 3ee45351598..5cb0d4155fc 100644 --- a/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.3.sql +++ b/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.3.sql @@ -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; diff --git a/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.4.sql b/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.4.sql index 54e6d48b499..6c43ed3bca3 100644 --- a/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.4.sql +++ b/server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.0.1.4.sql @@ -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; diff --git a/server/controller/db/metadb/migrator/schema/rawsql/postgres/init.sql b/server/controller/db/metadb/migrator/schema/rawsql/postgres/init.sql index b05082f5722..b347738f837 100644 --- a/server/controller/db/metadb/migrator/schema/rawsql/postgres/init.sql +++ b/server/controller/db/metadb/migrator/schema/rawsql/postgres/init.sql @@ -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, @@ -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, diff --git a/server/controller/db/metadb/model/model.go b/server/controller/db/metadb/model/model.go index 94563124d78..18ee8a5854e 100644 --- a/server/controller/db/metadb/model/model.go +++ b/server/controller/db/metadb/model/model.go @@ -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"` @@ -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"`