delete
from tbl_paln;
delete
from tbl_paln_task;
delete
from tbl_incident;
delete
from tbl_incident_process;

create table b_plan
(
    id          bigint not null
        primary key,
    name        varchar(255),
    type        integer,
    create_by   varchar(64),
    create_time timestamp(0),
    create_dept varchar(64),
    update_by   varchar(64),
    update_time timestamp(0),
    del_flag    char default '0'
);
comment
on table  b_plan is '预案管理';
comment
on column b_plan.id is '主键id';
comment
on column b_plan.name is '预案名称';
comment
on column b_plan.type is '预案类型';
comment
on column b_plan.create_by is '创建人';
comment
on column b_plan.create_time is '创建时间';
comment
on column b_plan.create_dept is '创建部门';


create table b_plan_task
(
    id          bigint not null
        primary key,
    plan_id     bigint,
    level       int,
    task_name   varchar(255),
    task_des    varchar(2550),
    create_by   varchar(64),
    create_time timestamp(0),
    update_by   varchar(64),
    update_time timestamp(0),
    del_flag    char default '0'
);

comment
on table  b_plan_task is '预案任务管理';
comment
on column b_plan_task.id is '任务id';
comment
on column b_plan_task.plan_id is '所属预案id';
comment
on column b_plan_task.level is '预案等级';
comment
on column b_plan_task.task_name is '任务名称';
comment
on column b_plan_task.task_des is '任务描述';
comment
on column b_plan_task.create_by is '创建用户';
comment
on column b_plan_task.create_time is '创建时间';

create table b_plan_file
(
    id          bigint not null primary key,
    plan_id     bigint,
    file_name   varchar(255),
    file_url    varchar(255),
    create_by   varchar(64),
    create_time timestamp(0),
    update_by   varchar(64),
    update_time timestamp(0),
    del_flag    char default '0'
);

comment
on table  b_plan_file is '预案文件管理';
comment
on column b_plan_file.id is '=id';
comment
on column b_plan_file.plan_id is '任务id';
comment
on column b_plan_file.file_name is '文件名称';
comment
on column b_plan_file.file_url is '文件路径';
