create type enum_task_state as enum ('备份中', '备份成功', '备份失败', '恢复中', '恢复成功', '恢复失败');

create table backups
(
    id            serial
        constraint backups_pk
            primary key,
    note          varchar(255) not null,
    databases     jsonb,
    size          varchar(255),
    create_time   timestamp with time zone,
    complete_time timestamp with time zone,
    state         enum_task_state,
    source        text
);

comment on table backups is '备份任务表';

comment on column backups.note is '备注信息';

comment on column backups.complete_time is '备份完成时间';

comment on column backups.source is '备份文件路径';

create unique index backups_id_uindex
    on backups (id);