| 123456789101112131415161718192021222324252627 |
- -- ******************************************************************
- -- 表 kku_cleanup_logs 的创建SQL
- -- 对应的Model: App\Module\Cleanup\Models\CleanupLog
- -- 警告: 此文件由系统自动生成,禁止修改!
- -- ******************************************************************
- CREATE TABLE `kku_cleanup_logs` (
- `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
- `task_id` bigint unsigned NOT NULL COMMENT '任务ID',
- `table_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '表名',
- `model_class` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Model类名',
- `cleanup_type` tinyint unsigned NOT NULL COMMENT '清理类型:1清空表,2删除所有,3按时间删除,4按用户删除,5按条件删除',
- `before_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '清理前记录数',
- `after_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '清理后记录数',
- `deleted_records` bigint unsigned NOT NULL DEFAULT '0' COMMENT '删除记录数',
- `execution_time` decimal(8,3) NOT NULL DEFAULT '0.000' COMMENT '执行时间(秒)',
- `conditions` json DEFAULT NULL COMMENT '使用的清理条件',
- `error_message` text COLLATE utf8mb4_unicode_ci COMMENT '错误信息',
- `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
- PRIMARY KEY (`id`),
- KEY `idx_task_id` (`task_id`),
- KEY `idx_table_name` (`table_name`),
- KEY `idx_cleanup_type` (`cleanup_type`),
- KEY `idx_created_at` (`created_at`),
- KEY `idx_model_class` (`model_class`),
- CONSTRAINT `kku_cleanup_logs_ibfk_1` FOREIGN KEY (`task_id`) REFERENCES `kku_cleanup_tasks` (`id`) ON DELETE CASCADE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='清理日志表';
|