Updating instead of making new entries of sync smart contract event


is it possible that a new emitted event from smart contract would only change the values of the previous synced entry in the database based on the value in one of the columns?

I’ll make an example …

The first time the event is synced the table would look like this:
objectId | id | var1 | var2
d2d12e1 | 4 | Bob | Alice

The next time event is synced with an id=4, there wouldn’t be a new entry in the table but it would update the entry that has “4” in column id. So if it would emit John at var1, the updated entry would look like this:

objectId | id | value1 | value2
d2d12e1 | 4 | John | Alice

Is that possible to do? The reason is that I would like to avoid many numbers of entries in the database when running an auction.

Thanks in advance.

You could do a post processing from time to time to delete the old events, or you could try to use a trigger like afterSave where you can check if it is an older event with same id and to delete it.

1 Like

Thanks @cryptokid. That was a really quick reply, thanks :pray:
I will try the afterSave trigger.