您的位置 首页 java

java网盘设计之数据库篇

 create table tenant_disk_info
(
    disk_id     bigint auto_increment primary key comment '网盘id',
    disk_name   varchar(255) not null comment '网盘名称',
    tenant_id     bigint       not null comment '所属租户id',
    total_size  bigint       not null comment '总磁盘大小',
    use_size    bigint       not null comment '已使用磁盘大小',
    version     varchar(50)  null comment '版本信息',
    create_time datetime     null comment '创建时间',
    create_user bigint       not null comment '创建用户',
    key idx_t_d_i_team_id (team_id)
) comment '租户-网盘空间表';

create table disk_file_info
(
    file_id        bigint auto_increment primary key comment '文件id',
    disk_id        bigint           not null comment '网盘id',
    file_name      varchar(255)     not null comment '文件名',
    all_text       longtext,-- 文件名分词存储
    file_ext       varchar(8)       null comment '文件扩展名',
    file_md5       varchar(32)      null comment '文件MD5',
    file_size      bigint default 0 not null comment '文件大小',
    file_type      int                  comment '0文件夹1音视频文件2文本3压缩包4未知类型',
    file_status    int    default 0 not null comment '状态 ,0:上传中,1:失败,2:正常,3:回收中,4,oss清理中',
    duration       bigint           null comment '音视频时长',
    create_time    datetime         not null comment '创建时间',
    create_user    bigint           not null comment '创建用户',
    update_time    datetime         not null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
    delete_time    datetime         null comment '刪除时间',
    delete_user    bigint           null comment '刪除用户',
    parent_id      bigint default 0 not null comment '文件父级id',
    is_recycle_record  int default 0 not null  comment '为否为回收站记录:0不是1是',
    key idx_t_d_f_file_md5 (file_md5),
    key idx_t_d_f_file_status (file_status),
    key idx_t_d_f_disk_id_is_recycle_record (disk_id, is_recycle_record),
    key idx_t_d_f_parent_id (parent_id),
    FULLTEXT KEY ft_t_d_f_file_name (all_text)
) comment '网盘文件信息表';

create table disk_share_info
(
    share_id       bigint auto_increment primary key comment '分享id',
    file_ids       VARCHAR(255)  null comment '批量分享时,分享对应的文件ids',
    file_id        bigint        not null comment '主文件id,分享列表取其名来显示',
    share_token    varchar(255)  not null comment '分享token',
    share_pwd      varchar(4)    null comment '分享密码',
    share_duration int default 1 not null comment '0:对应1天,1:对应7天,2:对应30天,3:永久有效',
    share_status   int default 0 not null comment '分享状态0:正常1:失效',
    create_user    bigint        not null comment '创建用户',-- 创建用户既为分享用户
    create_time    datetime      null comment '创建时间',
    expire_time    datetime      null comment '失效时间',--定时任务清除超过一个月的失效文件
    key idx_t_d_s_create_time (create_time),
    key idx_t_d_s_expire_time (expire_time),
    key idx_t_d_s_file_id (file_id),
    key idx_t_d_s_share_token (share_token)
) comment '网盘文件分享表';  

文章来源:智云一二三科技

文章标题:java网盘设计之数据库篇

文章地址:https://www.zhihuclub.com/177368.shtml

关于作者: 智云科技

热门文章

网站地图