Skip to content

Commit

Permalink
feat: create floor.IsSensitive composite indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Nov 12, 2023
1 parent a8b7df8 commit 81ee756
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions models/floor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
type Floor struct {
/// saved fields
ID int `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"time_created" gorm:"index"`
UpdatedAt time.Time `json:"time_updated" gorm:"index"`
CreatedAt time.Time `json:"time_created" gorm:"index:,sort:desc"`
UpdatedAt time.Time `json:"time_updated" gorm:"index:,sort:desc;index:idx_floor_actual_sensitive_updated_at,priority:3,sort:desc"`

/// base info

Expand Down Expand Up @@ -55,10 +55,10 @@ type Floor struct {
SpecialTag string `json:"special_tag"`

// auto sensitive check
IsSensitive bool `json:"is_sensitive"`
IsSensitive bool `json:"is_sensitive" gorm:"index:idx_floor_actual_sensitive_updated_at,priority:1"`

// manual sensitive check
IsActualSensitive *bool `json:"is_actual_sensitive"`
IsActualSensitive *bool `json:"is_actual_sensitive" gorm:"index:idx_floor_actual_sensitive_updated_at,priority:2"`

/// association info, should add foreign key

Expand Down

0 comments on commit 81ee756

Please sign in to comment.