mirror of
https://github.com/DullJZ/s3-balance.git
synced 2026-09-06 16:27:38 +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 存储桶月度统计信息模型
|
// BucketMonthlyStats 存储桶月度统计信息模型
|
||||||
type BucketMonthlyStats struct {
|
type BucketMonthlyStats struct {
|
||||||
ID uint `gorm:"primaryKey" json:"id"`
|
ID uint `gorm:"primaryKey" json:"id"`
|
||||||
BucketName string `gorm:"index:idx_bucket_month;size:255;not null" json:"bucket_name"`
|
BucketName string `gorm:"uniqueIndex:idx_bucket_month;size:255;not null" json:"bucket_name"`
|
||||||
Year int `gorm:"index:idx_bucket_month;not null" json:"year"`
|
Year int `gorm:"uniqueIndex:idx_bucket_month;not null" json:"year"`
|
||||||
Month int `gorm:"index:idx_bucket_month;not null" json:"month"`
|
Month int `gorm:"uniqueIndex:idx_bucket_month;not null" json:"month"`
|
||||||
OperationCountA int64 `gorm:"not null;default:0" json:"operation_count_a"`
|
OperationCountA int64 `gorm:"not null;default:0" json:"operation_count_a"`
|
||||||
OperationCountB int64 `gorm:"not null;default:0" json:"operation_count_b"`
|
OperationCountB int64 `gorm:"not null;default:0" json:"operation_count_b"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
|||||||
Reference in New Issue
Block a user