Skip to content

Commit

Permalink
Merge pull request #171 from mraerino/fix/sql-indices
Browse files Browse the repository at this point in the history
Optimize indices for large tables
  • Loading branch information
bcomnes authored Jan 31, 2019
2 parents d717211 + e713513 commit 65c4629
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Download struct {

CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"-" sql:"index:idx_downloads_deleted_at"`
DeletedAt *time.Time `json:"-" sql:"index"`
}

// TableName returns the database table name for the Download model.
Expand Down
6 changes: 3 additions & 3 deletions models/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const (

// Order model
type Order struct {
InstanceID string `json:"-"`
InstanceID string `json:"-" sql:"index"`
ID string `json:"id"`
InvoiceNumber int64 `json:"invoice_number,omitempty"`

Expand Down Expand Up @@ -100,9 +100,9 @@ type Order struct {
Coupon *Coupon `json:"coupon,omitempty" sql:"-"`
RawCoupon string `json:"-" sql:"type:text"`

CreatedAt time.Time `json:"created_at"`
CreatedAt time.Time `json:"created_at" sql:"index"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"-" sql:"index:idx_orders_deleted_at"`
DeletedAt *time.Time `json:"-" sql:"index"`
}

// TableName returns the database table name for the Order model.
Expand Down

0 comments on commit 65c4629

Please sign in to comment.