mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-06-30 07:21:21 +08:00
Fix: Add unique index to prevent duplicate monthly stats records
This commit is contained in:
@@ -48,9 +48,9 @@ func (BucketStats) TableName() string {
|
||||
// BucketMonthlyStats 存储桶月度统计信息模型
|
||||
type BucketMonthlyStats struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
BucketName string `gorm:"index:idx_bucket_month;size:255;not null" json:"bucket_name"`
|
||||
Year int `gorm:"index:idx_bucket_month;not null" json:"year"`
|
||||
Month int `gorm:"index:idx_bucket_month;not null" json:"month"`
|
||||
BucketName string `gorm:"uniqueIndex:idx_bucket_month;size:255;not null" json:"bucket_name"`
|
||||
Year int `gorm:"uniqueIndex:idx_bucket_month;not null" json:"year"`
|
||||
Month int `gorm:"uniqueIndex:idx_bucket_month;not null" json:"month"`
|
||||
OperationCountA int64 `gorm:"not null;default:0" json:"operation_count_a"`
|
||||
OperationCountB int64 `gorm:"not null;default:0" json:"operation_count_b"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
Reference in New Issue
Block a user