diff options
| author | Zahar Izmailov <izmailov9@gmail.com> | 2025-02-03 15:36:03 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-03 15:36:03 +0300 |
| commit | b922d986d6783ce28d00ca948024dee44a11f29e (patch) | |
| tree | 646c000eca419a8f0ad4e742762bfcf74f8f9a07 /database/model/model.go | |
| parent | 8a7cffd63f4ced8caaa20e90aa60228d24bda510 (diff) | |
Improved database model migration and added indexing (#2655)
Diffstat (limited to 'database/model/model.go')
| -rw-r--r-- | database/model/model.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/database/model/model.go b/database/model/model.go index e9d1836f..915cae0b 100644 --- a/database/model/model.go +++ b/database/model/model.go @@ -29,14 +29,14 @@ type User struct { type Inbound struct { Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"` - UserId int `json:"-"` + UserId int `json:"-" gorm:"index"` Up int64 `json:"up" form:"up"` Down int64 `json:"down" form:"down"` Total int64 `json:"total" form:"total"` Remark string `json:"remark" form:"remark"` Enable bool `json:"enable" form:"enable"` ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` - ClientStats []xray.ClientTraffic `gorm:"foreignKey:InboundId;references:Id" json:"clientStats" form:"clientStats"` + ClientStats []xray.ClientTraffic `gorm:"foreignKey:InboundId;references:Id;constraint:OnDelete:CASCADE" json:"clientStats"` // config part Listen string `json:"listen" form:"listen"` |
