-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from getAlby/fix/index-events
feat: new index for latest event by app_id
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package migrations | ||
|
||
import ( | ||
"github.com/go-gormigrate/gormigrate/v2" | ||
"gorm.io/gorm" | ||
) | ||
|
||
// Create a composite index to improve performance of finding the latest nostr event for an app | ||
var _202401092201_add_events_id_index = &gormigrate.Migration{ | ||
ID: "202401092201_add_events_id_index", | ||
Migrate: func(tx *gorm.DB) error { | ||
return tx.Exec("CREATE INDEX idx_nostr_events_app_id_and_id ON nostr_events(app_id, id)").Error | ||
}, | ||
Rollback: func(tx *gorm.DB) error { | ||
return nil | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters