Observe age of entries in the database and trigger event

74 Views Asked by At

I'm wondering if there's a way to trigger an event into a database based on the age of the row entry. Based in a datetime field I will need to retrieve the entrys that match an exact age, but I don't want to stress the database. So I need the database to create an event in where if the field is in the database when the time comes, it will send a message or something like that.

Examples:

I have an entry that was created 23:59 hours ago. I want to trigger an event when the field reaches 24:00 hours.

I have a backend which should receive a command each time an entry becomes 1 day old.

1

There are 1 best solutions below

0
On BEST ANSWER

When you INSERT the row (or otherwise set/change the time), create a one-time EVENT for 24 hours hence.

This would have to be in your application code, since "Events cannot be created, dropped or altered by another stored program, trigger or event."