Skip to content

Commit

Permalink
fix: create index on events
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Jan 9, 2024
1 parent 3289026 commit 5e95d1e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions migrations/202401092201_add_events_id_index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package migrations

import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)

// Create a composite index to improve performance of summing payments in the current budget period
var _202401092201_add_events_id_index = &gormigrate.Migration{
ID: "202401092201_add_events_id_index",
Migrate: func(tx *gorm.DB) error {

var sql string
sql = "CREATE INDEX idx_nostr_events_app_id_and_id ON nostr_events(app_id, id)"

return tx.Exec(sql).Error
},
Rollback: func(tx *gorm.DB) error {
return nil
},
}

0 comments on commit 5e95d1e

Please sign in to comment.