drop table if exists fdroid.app_info;
create table if not exists fdroid.app_info
(
    id int auto_increment primary key,
    app_name varchar(30) not null,
    icon text,
    description text,
    repo_url text,
    author_id int not null,
    author_name varchar(30) not null,
    rate double not null default 0,
    rate_count double not null default 0,
    category varchar(20),
    build_branch varchar(20) not null ,
    daily_build_branch varchar(20),
    enable_daily_build boolean not null default false,
    create_time timestamp default current_timestamp not null
) charset = utf8;

drop table if exists fdroid.build_task;
create table if not exists fdroid.build_task
(
    id int auto_increment primary key,
    app_id int not null,
    create_user_id int not null,
    create_user_name varchar(30) not null,
    description text,
    version varchar(20) not null,
    create_time timestamp default current_timestamp not null,
    update_time timestamp,
    status varchar(20) not null,
    build_type varchar(20) not null,
    message text
) charset = utf8;

drop table if exists fdroid.app_contribute_relation;
create table if not exists fdroid.app_contribute_relation
(
    id int auto_increment primary key,
    app_id int not null,
    user_id int not null
) charset = utf8;

drop table if exists fdroid.bug;
create table if not exists fdroid.bug
(
    id int auto_increment primary key,
    app_id int not null ,
    version varchar(20) not null ,
    user_id int not null ,
    user_name int not null ,
    create_time timestamp default current_timestamp not null ,
    update_time timestamp,
    fixed boolean default false not null ,
    description text not null
) charset = utf8;