Skip to content

Commit 65c4629

Browse files
authored
Merge pull request #171 from mraerino/fix/sql-indices
Optimize indices for large tables
2 parents d717211 + e713513 commit 65c4629

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

models/download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type Download struct {
2222

2323
CreatedAt time.Time `json:"created_at"`
2424
UpdatedAt time.Time `json:"updated_at"`
25-
DeletedAt *time.Time `json:"-" sql:"index:idx_downloads_deleted_at"`
25+
DeletedAt *time.Time `json:"-" sql:"index"`
2626
}
2727

2828
// TableName returns the database table name for the Download model.

models/order.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const (
5050

5151
// Order model
5252
type Order struct {
53-
InstanceID string `json:"-"`
53+
InstanceID string `json:"-" sql:"index"`
5454
ID string `json:"id"`
5555
InvoiceNumber int64 `json:"invoice_number,omitempty"`
5656

@@ -100,9 +100,9 @@ type Order struct {
100100
Coupon *Coupon `json:"coupon,omitempty" sql:"-"`
101101
RawCoupon string `json:"-" sql:"type:text"`
102102

103-
CreatedAt time.Time `json:"created_at"`
103+
CreatedAt time.Time `json:"created_at" sql:"index"`
104104
UpdatedAt time.Time `json:"updated_at"`
105-
DeletedAt *time.Time `json:"-" sql:"index:idx_orders_deleted_at"`
105+
DeletedAt *time.Time `json:"-" sql:"index"`
106106
}
107107

108108
// TableName returns the database table name for the Order model.

0 commit comments

Comments
 (0)