labtech
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
CleanupSystemEventDates
Parameters
Name
Type
Mode
Definition
BEGIN -- This stored procedure is intended to keep the systemeventdates tables with the least amount of records as possible while still keeping at least one entry per eventsource type. DROP TEMPORARY TABLE IF EXISTS `tempSystemEventDates`; CREATE TEMPORARY TABLE `tempSystemEventDates` (EventSource VARCHAR(50),eventdate TIMESTAMP); INSERT INTO `tempSystemEventDates` SELECT 'AlertTemplates', MAX(EventDate) FROM SystemEventDates WHERE EventSource='AlertTemplates'; INSERT INTO `tempSystemEventDates` SELECT 'WriteConfigControl', MAX(EventDate) FROM SystemEventDates WHERE EventSource='WriteConfigControl'; TRUNCATE `SystemEventDates`; INSERT IGNORE INTO `SystemEventDates` (`EventSource`,`EventDate`) SELECT `EventSource`,`EventDate` FROM `tempSystemEventDates`; DROP TEMPORARY TABLE IF EXISTS `tempSystemEventDates`; CALL PopulateSystemEventDates(); END