四好公路
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.9 KiB

create table if not exists road_spot_check_preview
(
id serial not null
constraint report_spot_check_preview_v2_pk
primary key,
county_percentage integer not null,
date timestamp with time zone,
county_road_id integer[],
township_road_id integer[],
checked boolean default false not null,
village_road_id integer[],
village_id integer[]
);
comment on table road_spot_check_preview is '道路抽查预览表';
comment on column road_spot_check_preview.county_percentage is '县道抽查比例';
comment on column road_spot_check_preview.date is '抽取时间';
comment on column road_spot_check_preview.county_road_id is '抽到的县道id';
comment on column road_spot_check_preview.township_road_id is '乡道id';
comment on column road_spot_check_preview.checked is '是否应用';
comment on column road_spot_check_preview.village_road_id is '村道id';
comment on column road_spot_check_preview.village_id is '抽到的村庄的id';
create unique index if not exists report_spot_check_preview_v2_id_uindex
on road_spot_check_preview (id);
create table if not exists road_spot_check
(
id serial not null
constraint report_spot_check_v2_pk
primary key,
road_id integer not null,
maintenance_count integer,
prepare_id integer not null
);
comment on table road_spot_check is '抽查结果表';
comment on column road_spot_check.maintenance_count is '抽查时养护次数';
comment on column road_spot_check.prepare_id is '抽查预览id';
create unique index if not exists report_spot_check_v2_id_uindex
on road_spot_check (id);
create table if not exists road_spot_check_change_log
(
id serial not null
constraint road_spot_check_change_log_pk
primary key,
user_id integer not null,
time timestamp with time zone not null,
content varchar(1024),
origin_road_id integer not null,
change_road_id integer not null,
prepare_id integer
constraint road_spot_check_change_log_road_spot_check_preview_id_fk
references road_spot_check_preview
);
comment on table road_spot_check_change_log is '道路养护抽查调整日志';
comment on column road_spot_check_change_log.user_id is '修改者';
comment on column road_spot_check_change_log.content is '修改内容描述';
comment on column road_spot_check_change_log.origin_road_id is '原本的道路';
comment on column road_spot_check_change_log.change_road_id is '更改后的道路';
comment on column road_spot_check_change_log.prepare_id is '抽查预览id';
create unique index if not exists road_spot_check_change_log_id_uindex
on road_spot_check_change_log (id);