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 f458952
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions migrations/202401092201_add_events_id_index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package migrations

import (
"log"

"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;
},
}

;

Check failure on line 25 in migrations/202401092201_add_events_id_index.go

View workflow job for this annotation

GitHub Actions / build

syntax error: non-declaration statement outside function body

Check failure on line 25 in migrations/202401092201_add_events_id_index.go

View workflow job for this annotation

GitHub Actions / build

syntax error: non-declaration statement outside function body

0 comments on commit f458952

Please sign in to comment.