create table if not exists storage_source
(
    id                            integer
        primary key autoincrement,
    enable                        bit          null,
    enable_cache                  bit          null,
    name                          varchar(255) null,
    auto_refresh_cache            bit          null,
    type                          varchar(64)  null,
    search_enable                 bit          null,
    search_ignore_case            bit          null,
    order_num                     int          null,
    default_switch_to_img_mode    bit          null,
    remark                        text         null,
    `key`                         varchar(64)  null,
    enable_file_operator          bit          null,
    search_mode                   varchar(32)  null,
    enable_file_anno_operator     bit          null
);

create table if not exists filter_config
(
    id           integer
        primary  key autoincrement,
    storage_id   int           null,
    expression   varchar(255)  null,
    description varchar(255)   null,
    mode varchar(255)           null
);

create table if not exists short_link
(
    id          integer
        primary key autoincrement,
    short_key   varchar(255) null,
    url         text         null,
    create_date datetime         null,
    storage_id  int          null
);

create table if not exists storage_source_config
(
    id         integer
        primary key autoincrement,
    name       varchar(255) null,
    type       text         null,
    title      varchar(255) null,
    storage_id int          null,
    value      text         null
);

create table if not exists system_config
(
    id    integer
        primary key autoincrement,
    name     varchar(255) null,
    value varchar(255) null,
    title varchar(255) null
);

create table if not exists password_config
(
    id         integer
        primary key autoincrement,
    storage_id integer      null,
    expression varchar(255) null,
    password   varchar(255) null,
    description varchar(255)   null
);

create table if not exists readme_config
(
    id         integer
        primary key autoincrement,
    storage_id integer      null,
    expression varchar(255) null,
    description varchar(255)   null,
    readme_text text null,
    display_mode varchar(32) null
);

create table if not exists download_log
(
    id                            integer
        primary key autoincrement,
    path        text null ,
    storage_key varchar(32) null,
    create_time datetime null,
    ip varchar(20) null,
    user_agent varchar(2048) null,
    referer varchar(2048) null,
    short_key varchar(255) null
);