zhangqian
2023-09-21 a2fcc4be5f133d490f20fa4d2401811d8e1307d9
更改字段类型,避免gorm每次重启程序时重建表
1个文件已修改
10 ■■■■ 已修改文件
model/device_plc.go 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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"`   //串口名称,method = 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"`                //串口名称,method = serial时 用
        IsOpen     bool   `gorm:"comment:是否开启" json:"isOpen"`
        Detail     string `gorm:"type:varchar(2048);comment:数据详情" json:"-"`
        Details []*DevicePlcAddress `gorm:"-" json:"details"`