修复软删除和唯一索引同时存在的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

@@ -31,7 +31,7 @@ const (
// PigBatch 是猪批次的核心模型,代表了一群被共同管理的猪
type PigBatch struct {
Model
BatchNumber string `gorm:"size:50;not null;uniqueIndex;comment:批次编号,如 2024-W25-A01"`
BatchNumber string `gorm:"size:50;not null;comment:批次编号,如 2024-W25-A01"`
OriginType PigBatchOriginType `gorm:"size:20;not null;comment:批次来源 (自繁, 外购)"`
StartDate time.Time `gorm:"not null;comment:批次开始日期 (如转入日或购买日)"`
EndDate time.Time `gorm:"not null;comment:批次结束日期 (全部淘汰或售出)"`