create table cover_generate_log
(
    task_id     varchar(64)   not null
        primary key,
    user_id     varchar(64)   null,
    ssid        varchar(64)   null,
    device_id   varchar(64)   null,
    phone       varchar(32)   null,
    song_id     varchar(64)   null,
    singer_id   varchar(64)   null,
    start_time  datetime      null,
    send_time   datetime      null,
    handle_time datetime      null,
    finish_time datetime      null,
    fail_reason varchar(5000) null
);

create index idx_start_time
    on cover_generate_log (start_time);

create table cover_material
(
    id           bigint auto_increment
        primary key,
    singer_id    varchar(64)   null comment '歌手id',
    ssid         varchar(64)   null comment 'ssid',
    name         varchar(32)   null comment '素材名称',
    material_url varchar(255)  null comment '素材地址',
    duration     double(11, 2) null comment '时长',
    status       int           null comment '状态',
    create_time  datetime      null comment '创建时间',
    update_time  datetime      null comment '更新实际'
);

create index idx_singer_id
    on cover_material (singer_id);

create index idx_ssid
    on cover_material (ssid);

create table cover_singer
(
    id             varchar(64)                not null
        primary key,
    ssid           varchar(64)                not null comment 'ssid',
    nickname       varchar(32)                null comment '昵称',
    avatar         varchar(255)               null comment '头像',
    material_count int           default 0    null comment '素材数量',
    duration       double(11, 2) default 0.00 null comment '总时长',
    status         int                        null comment '状态 0-未设置歌手信息 1-已设置歌手信息',
    train_count    int           default 0    null comment '已训练次数',
    train_status   int                        null comment '训练状态 0-未训练 1-训练中 2-训练成功 3-训练失败',
    sort           int                        null comment '位置',
    audio_url      varchar(255)               null comment '试听音频',
    is_deleted     int           default 0    null comment '是否被删除 0-否 1-是',
    create_time    datetime                   null comment '创建时间',
    update_time    datetime                   null comment '更新时间'
);

create index idx_ssid
    on cover_singer (ssid);

create table cover_train_log
(
    task_id     varchar(64)   not null
        primary key,
    user_id     varchar(64)   null,
    ssid        varchar(64)   null,
    device_id   varchar(64)   null,
    phone       varchar(32)   null,
    singer_id   varchar(64)   null,
    start_time  datetime      null,
    send_time   datetime      null,
    handle_time datetime      null,
    finish_time datetime      null,
    fail_reason varchar(5000) null
);

create index idx_start_time
    on cover_train_log (start_time);



alter table song_info
    add cover_audio_url varchar(255) null after origin_image_large_url;

alter table song_info
    add singer_id varchar(64) null after cover_audio_url;