Preprocess BlockEventType and BlockEventAttributeKey relations before BlockEvent bulk insertion
Closed this issue · 1 comments
pharr117 commented
The way the new models work here:
will take a bit of preprocessing to make sure the model relationships exist before BlockEvent Bulk insertion.
The basic workflow will be:
- Keep a mapping unique of BlockEventTypes and BlockEventAttributeKey
- Insert the unique items first with an OnConflict do nothing returning id clause
- Loop through the BlockEvent and apply the correct model items
This will be possible in a brute force manner, but we should attempt to see if this is possible in GORM as a one-liner.
Doing the above will allow the app to do bulk insertion in GORM rather than doing a naive insertion loop that will hit the database much harder.
This will also be a similar principal that can be applied to Message Event insertion.