/**
Source Server Version: 8.0.31
Source Database: backendsys
Date: 2023/05/23 17:09:22
*/

DROP TABLE IF EXISTS `sys_file`;
CREATE TABLE `sys_file` (
    PRIMARY KEY (`id`),
    `id` BIGINT AUTO_INCREMENT COMMENT 'ID',
    `category_id` BIGINT COMMENT '分类ID',
    `request_id` VARCHAR(100) COMMENT '请求响应ID',
    `user_id` BIGINT COMMENT '上传用户ID',
    `name` VARCHAR(255) COMMENT '文件名称',
    `content_type` VARCHAR(255) COMMENT '文件类型',
    `url` VARCHAR(2000) COMMENT 'URL',
    `url_thumb` VARCHAR(2000) COMMENT '缩略图',
    `object_key` VARCHAR(500) NOT NULL COMMENT 'ObjectKey',
    `size` INT COMMENT '文件大小',
    `md5` VARCHAR(255) COMMENT '文件MD5',
    `upload_id` VARCHAR(100) COMMENT '分块上传ID',
    `upload_chunk_count` INT COMMENT '分块文件数量',
    `upload_chunk_index` INT COMMENT '分块文件索引',
    `target` INT COMMENT '上传目标 (-1:本地, 1:腾讯云, 2:阿里云, 3.抖音云)',
    `upload_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '上传时间',
    `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    UNIQUE KEY (`upload_id`),
    INDEX `idx_category_id` (`category_id`),
    INDEX `idx_user_id` (`user_id`)
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='系统上传文件表';
