create table patrol_record
(
        id serial,
        patrol_plan_id int not null,
        last_inspection_time timestamp,
        inspection_time timestamp,
        points jsonb,
        alarm boolean default false not null,
        point_id int,
);

comment on column patrol_record.patrol_plan_id is '对应巡检计划的id';

comment on column patrol_record.last_inspection_time is '上次巡检时间';

comment on column patrol_record.inspection_time is '本次巡检时间';

comment on column patrol_record.points is '点位详情数组';

comment on column patrol_record.alarm is '是否异常';

comment on column patrol_record.point_id is '点位Id';

create unique index patrol_record_id_uindex
        on patrol_record (id);

alter table patrol_record
        add constraint patrol_record_pk
                primary key (id);