-- 表: backups
-- 自动生成于: 2026-03-06 00:39:05

DROP TABLE IF EXISTS `backups`;
CREATE TABLE `backups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL COMMENT '用户ID',
  `bt_id` int(11) NOT NULL COMMENT 'BT面板ID',
  `backup_name` varchar(255) NOT NULL COMMENT '备份名称',
  `backup_type` varchar(20) NOT NULL COMMENT '备份类型：full,database,files',
  `backup_path` varchar(512) DEFAULT NULL COMMENT '备份文件路径',
  `backup_size` bigint(20) DEFAULT '0' COMMENT '备份文件大小（字节）',
  `status` varchar(20) DEFAULT 'pending' COMMENT '备份状态：pending,success,failed',
  `error_message` text COMMENT '错误信息',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `complete_time` datetime DEFAULT NULL COMMENT '完成时间',
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_bt_id` (`bt_id`),
  KEY `idx_status` (`status`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='备份记录表';

