bryanlabs/cosmos-indexer-sdk

Consider implementing has many relation on the BlockEvent model to list BlockEventAttributes

Opened this issue · 0 comments

The first implementation of the BlockEventAttribute model has implemented a belongs to relation on the BlockEvent table. We should consider moving to a has_many relation from BlockEvents -> BlockEventAttributes. This may make insert much faster and reduce the amount of preprocessing needed on the BlockEventAttribute table during batch insert here:

https://github.com/DefiantLabs/cosmos-indexer/blob/45f92b64f76037c9f3e40e0089c087142578f8e7/db/events.go#L108-L136

Its possible this could become a one-liner by passing in the attributes as an array. We would probably still need to pre-process the AttributeKeys and apply them to the items.