add index to event.emitter_addr

This commit is contained in:
i-norden 2023-11-30 13:03:36 -06:00 committed by jonathan@vulcanize.io
parent ff21559244
commit 2e372edde4

View File

@ -46,6 +46,7 @@ var ddls = []string{
)`,
`CREATE INDEX IF NOT EXISTS height_tipset_key ON event (height,tipset_key)`,
`CREATE INDEX IF NOT EXISTS event_emitter_addr ON event (emitter_addr)`,
`CREATE TABLE IF NOT EXISTS event_entry (
event_id INTEGER,
@ -327,7 +328,8 @@ func NewEventIndex(ctx context.Context, path string, chainStore *store.ChainStor
if version == 2 {
log.Infof("upgrading event index from version 1 to version 2")
// to upgrade to version 3 we only need to create an index on the event entries table (key) column
// to upgrade to version 3 we only need to create an index on the event_entry.key column
// and on the event.emitter_addr column
// which means we can just reapply the schema (it will not have any effect on existing data)
for _, ddl := range ddls {
if _, err := db.Exec(ddl); err != nil {