change queries for events and alerts table.