重构creatingUniqueIndex和createGinIndexes
This commit is contained in:
@@ -12,6 +12,10 @@ type PigHouse struct {
|
||||
Pens []Pen `gorm:"foreignKey:HouseID"` // 一个猪舍包含多个猪栏
|
||||
}
|
||||
|
||||
func (ph PigHouse) TableName() string {
|
||||
return "pig_houses"
|
||||
}
|
||||
|
||||
// PenStatus 定义了猪栏的当前状态
|
||||
type PenStatus string
|
||||
|
||||
@@ -33,3 +37,7 @@ type Pen struct {
|
||||
Capacity int `gorm:"not null;comment:设计容量 (头)"`
|
||||
Status PenStatus `gorm:"not null;index;comment:猪栏当前状态"`
|
||||
}
|
||||
|
||||
func (p Pen) TableName() string {
|
||||
return "pens"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user