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.
50 lines
1.3 KiB
50 lines
1.3 KiB
create table if not exists village
|
|
(
|
|
id serial not null
|
|
constraint village_pk
|
|
primary key,
|
|
name varchar(256) not null,
|
|
township_code varchar(256),
|
|
longitude double precision,
|
|
latitude double precision
|
|
);
|
|
|
|
comment on table village is '村';
|
|
|
|
comment on column village.township_code is '所属乡镇代码';
|
|
|
|
comment on column village.longitude is '经度';
|
|
|
|
comment on column village.latitude is '纬度';
|
|
|
|
create unique index if not exists village_id_uindex
|
|
on village (id);
|
|
|
|
|
|
|
|
|
|
create table if not exists village_distance
|
|
(
|
|
id serial not null
|
|
constraint village_distance_pk
|
|
primary key,
|
|
origin_village integer not null
|
|
constraint village_distance_village_id_fk
|
|
references village,
|
|
calc_village integer
|
|
constraint village_distance_village_id_fk_2
|
|
references village,
|
|
distance integer
|
|
);
|
|
|
|
comment on table village_distance is '村之间的距离';
|
|
|
|
comment on column village_distance.origin_village is '原点村庄';
|
|
|
|
comment on column village_distance.calc_village is '相对计算村庄';
|
|
|
|
comment on column village_distance.distance is '距离 m';
|
|
|
|
create unique index if not exists village_distance_id_uindex
|
|
on village_distance (id);
|
|
|
|
|