· 8 years ago · Jun 08, 2018, 01:38 AM
1create event if not exists alerts_remover
2 on schedule every 1 day
3 starts current_timestamp
4 comment 'Gets the old entry ids THEN drops them from the table EACH day.'
5 do delete from alerts
6 where started_at < unix_timestamp(now() - interval 7 day)
7 order by started_at desc;