22 lines
1.5 KiB
MySQL
22 lines
1.5 KiB
MySQL
|
|
-- Create cron logs table for tracking cron job execution
|
||
|
|
CREATE TABLE IF NOT EXISTS `tbl_cron_logs` (
|
||
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||
|
|
`cron_type` varchar(50) NOT NULL DEFAULT 'main' COMMENT 'Type of cron job (main, reminder, etc.)',
|
||
|
|
`started_at` datetime NOT NULL COMMENT 'When cron job started',
|
||
|
|
`finished_at` datetime DEFAULT NULL COMMENT 'When cron job finished',
|
||
|
|
`status` enum('running','completed','failed') NOT NULL DEFAULT 'running' COMMENT 'Cron job status',
|
||
|
|
`expired_users_found` int(11) NOT NULL DEFAULT 0 COMMENT 'Number of expired users found',
|
||
|
|
`expired_users_processed` int(11) NOT NULL DEFAULT 0 COMMENT 'Number of expired users processed',
|
||
|
|
`notifications_sent` int(11) NOT NULL DEFAULT 0 COMMENT 'Number of notifications sent',
|
||
|
|
`auto_renewals_attempted` int(11) NOT NULL DEFAULT 0 COMMENT 'Number of auto-renewals attempted',
|
||
|
|
`auto_renewals_successful` int(11) NOT NULL DEFAULT 0 COMMENT 'Number of successful auto-renewals',
|
||
|
|
`error_message` text DEFAULT NULL COMMENT 'Error message if cron failed',
|
||
|
|
`execution_time` decimal(10,3) DEFAULT NULL COMMENT 'Execution time in seconds',
|
||
|
|
`memory_usage` varchar(20) DEFAULT NULL COMMENT 'Memory usage at completion',
|
||
|
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
|
PRIMARY KEY (`id`),
|
||
|
|
KEY `idx_cron_type` (`cron_type`),
|
||
|
|
KEY `idx_started_at` (`started_at`),
|
||
|
|
KEY `idx_status` (`status`)
|
||
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Cron job execution logs';
|