From a2fcc4be5f133d490f20fa4d2401811d8e1307d9 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 21 九月 2023 14:29:38 +0800 Subject: [PATCH] 更改字段类型,避免gorm每次重启程序时重建表 --- model/device_plc.go | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/model/device_plc.go b/model/device_plc.go index d2690ea..728488d 100644 --- a/model/device_plc.go +++ b/model/device_plc.go @@ -17,12 +17,12 @@ Brand string `gorm:"type:varchar(191);comment:PLC鍝佺墝" json:"brand"` Method constvar.PlcMethod `gorm:"type:varchar(191);comment:鎺ュ彛鏂瑰紡" json:"method"` //PortName string `gorm:"type:varchar(191);comment:绔彛鍚嶇О" json:"portName"` - //Frequency int `gorm:"type:int(11);comment:鏁版嵁鏇存柊棰戠巼 0-瀹炴椂鏇存柊 1-1娆�/绉�" json:"frequency"` + //Frequency int `gorm:"comment:鏁版嵁鏇存柊棰戠巼 0-瀹炴椂鏇存柊 1-1娆�/绉�" json:"frequency"` Address string `gorm:"type:varchar(191);comment:PLC鍦板潃" json:"address"` //plc ip鍦板潃锛� method = modbusTCP鐢� - Port int `gorm:"type:int(11);comment:绔彛" json:"port"` //plc 绔彛鍙凤紝 method = modbusTCP鐢� - BaudRate int `gorm:"type:int(11);comment:娉㈢壒鐜�" json:"baudRate"` //涓插彛娉㈢壒鐜囷紝 method = serial鏃� 鐢� - SerialName string `gorm:"type:int(11);comment:涓插彛鍚嶇О" json:"serialName"` //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢� - IsOpen bool `gorm:"type:tinyint(1);comment:鏄惁寮�鍚�" json:"isOpen"` + Port int `gorm:"comment:绔彛" json:"port"` //plc 绔彛鍙凤紝 method = modbusTCP鐢� + BaudRate int `gorm:"comment:娉㈢壒鐜�" json:"baudRate"` //涓插彛娉㈢壒鐜囷紝 method = serial鏃� 鐢� + SerialName string `gorm:"comment:涓插彛鍚嶇О" json:"serialName"` //涓插彛鍚嶇О锛宮ethod = serial鏃� 鐢� + IsOpen bool `gorm:"comment:鏄惁寮�鍚�" json:"isOpen"` Detail string `gorm:"type:varchar(2048);comment:鏁版嵁璇︽儏" json:"-"` Details []*DevicePlcAddress `gorm:"-" json:"details"` -- Gitblit v1.8.0