Skip to content

Commit ac66119

Browse files
ZhengYa-0110SongZhen0704
authored andcommitted
fix: correct match_type default value and reset it for IP/PORT type custom_services
1 parent 69c67d7 commit ac66119

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

server/controller/db/metadb/migrator/schema/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ const (
2020
RAW_SQL_ROOT_DIR = "/etc/metadb/schema/rawsql"
2121

2222
DB_VERSION_TABLE = "db_version"
23-
DB_VERSION_EXPECTED = "6.6.1.69"
23+
DB_VERSION_EXPECTED = "6.6.1.70"
2424
)

server/controller/db/metadb/migrator/schema/rawsql/mysql/ddl_create_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ CREATE TABLE IF NOT EXISTS custom_service (
12771277
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
12781278
name VARCHAR(128) NOT NULL,
12791279
type INTEGER DEFAULT 0 COMMENT '0: unknown 1: IP 2: PORT 3: chost 4: pod_service 5: pod_group 6:pod 7: host',
1280-
match_type INTEGER DEFAULT 1 COMMENT '0: unkonwn 1: name match 2: uid match',
1280+
match_type INTEGER DEFAULT 0 COMMENT '0: none 1: name match 2: uid match',
12811281
epc_ids TEXT COMMENT 'separated by ,',
12821282
pod_cluster_ids TEXT COMMENT 'separated by ,',
12831283
pod_namespace_ids TEXT COMMENT 'separated by ,',
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
-- Fix match_type default value and reset it for IP/PORT type custom_services
3+
ALTER TABLE custom_service MODIFY COLUMN match_type INTEGER DEFAULT 0 COMMENT '0: none 1: name match 2: uid match';
4+
5+
UPDATE custom_service SET match_type = 0 WHERE type IN (1, 2);
6+
7+
-- Update DB version
8+
UPDATE db_version SET version='6.6.1.70';

server/controller/db/metadb/model/platform_rsc_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ type CustomService struct {
10901090
OperatedTime `gorm:"embedded" mapstructure:",squash"`
10911091
Name string `gorm:"column:name;type:varchar(128);default:''" json:"NAME" mapstructure:"NAME"`
10921092
Type int `gorm:"column:type;type:int;default:0" json:"TYPE" mapstructure:"TYPE"`
1093-
MatchType int `gorm:"column:match_type;type:int;default:1" json:"MATCH_TYPE" mapstructure:"MATCH_TYPE"`
1093+
MatchType int `gorm:"column:match_type;type:int;default:0" json:"MATCH_TYPE" mapstructure:"MATCH_TYPE"`
10941094
VPCIDs AutoSplitedInts `gorm:"column:epc_ids;type:text;default:''" json:"EPC_IDS" mapstructure:"EPC_IDS"`
10951095
PodClusterIDs AutoSplitedInts `gorm:"column:pod_cluster_ids;type:text;default:''" json:"POD_CLUSTER_IDS" mapstructure:"POD_CLUSTER_IDS"`
10961096
PodNamespaceIDs AutoSplitedInts `gorm:"column:pod_namespace_ids;type:text;default:''" json:"POD_NAMESPACE_IDS" mapstructure:"POD_NAMESPACE_IDS"`

0 commit comments

Comments
 (0)