Skip to content

Commit

Permalink
Create index only if it does not exist
Browse files Browse the repository at this point in the history
otherwise the migration fails
  • Loading branch information
bumi authored Jan 10, 2024
1 parent 1b74154 commit 9f05856
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migrations/202401092201_add_events_id_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
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
return tx.Exec("CREATE INDEX IF NOT EXISTS idx_nostr_events_app_id_and_id ON nostr_events(app_id, id)").Error
},
Rollback: func(tx *gorm.DB) error {
return nil
Expand Down

0 comments on commit 9f05856

Please sign in to comment.