修复软删除和唯一索引同时存在的bug

This commit is contained in:
2025-11-20 17:37:02 +08:00
parent 1f3d3d8a7c
commit da934a9bbb
7 changed files with 80 additions and 8 deletions

View File

@@ -21,11 +21,11 @@ type AreaController struct {
Model
// Name 是主控的业务名称,例如 "1号猪舍主控"
Name string `gorm:"not null;unique" json:"name"`
Name string `gorm:"not null" json:"name"`
// NetworkID 是主控在通信网络中的唯一标识,例如 LoRaWAN 的 DevEUI。
// 这是 transport 层用来寻址的关键。
NetworkID string `gorm:"not null;unique;index" json:"network_id"`
NetworkID string `gorm:"not null;index" json:"network_id"`
// Location 描述了主控的物理安装位置。
Location string `gorm:"index" json:"location"`