Skip to content

Commit

Permalink
[CONTROLLER/DB] adds npb direction
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengya authored and SongZhen0704 committed Dec 25, 2023
1 parent dade5c9 commit abdbe0d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions server/controller/db/mysql/migration/rawsql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ CREATE TABLE IF NOT EXISTS npb_policy (
name CHAR(64),
state INTEGER DEFAULT 1 COMMENT '0-disable; 1-enable',
business_id INTEGER NOT NULL,
direction TINYINT(1) DEFAULT 1 COMMENT '1-all; 2-forward; 3-backward;',
vni INTEGER,
npb_tunnel_id INTEGER,
distribute TINYINT(1) DEFAULT 1 COMMENT '0-drop, 1-distribute',
Expand Down
5 changes: 5 additions & 0 deletions server/controller/db/mysql/migration/rawsql/issu/6.4.1.12.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE npb_policy ADD COLUMN direction TINYINT(1) DEFAULT 1 COMMENT '1-all; 2-forward; 3-backward;' AFTER business_id;

-- update db_version to latest, remember update DB_VERSION_EXPECT in migrate/version.go
UPDATE db_version SET version='6.4.1.12';
-- modify end
2 changes: 1 addition & 1 deletion server/controller/db/mysql/migration/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ package migration

const (
DB_VERSION_TABLE = "db_version"
DB_VERSION_EXPECTED = "6.4.1.11"
DB_VERSION_EXPECTED = "6.4.1.12"
)
1 change: 1 addition & 0 deletions server/controller/db/mysql/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ type NpbPolicy struct {
Name string `gorm:"column:name;type:char(64);default:null" json:"NAME"`
State int `gorm:"column:state;type:int;default:null;default:1" json:"STATE"` // 0-disable; 1-enable
BusinessID int `gorm:"column:business_id;type:int;not null" json:"BUSINESS_ID"`
Direction int `gorm:"column:direction;type:int;default:1" json:"DIRECTION"` // 1-two way; 2-server to client
Vni int `gorm:"column:vni;type:int;default:null" json:"VNI"`
NpbTunnelID int `gorm:"column:npb_tunnel_id;type:int;default:null" json:"NPB_TUNNEL_ID"`
Distribute int `gorm:"column:distribute;type:int;default:null" json:"distribute"` // 0-drop, 1-distribute
Expand Down

0 comments on commit abdbe0d

Please sign in to comment.