巴林闲侠
2 years ago
1 changed files with 90 additions and 0 deletions
@ -0,0 +1,90 @@ |
|||||
|
create table if not exists mirror |
||||
|
( |
||||
|
id serial not null, |
||||
|
template varchar(63) not null, |
||||
|
create_user integer not null, |
||||
|
create_time timestamp with time zone not null, |
||||
|
update_time timestamp with time zone, |
||||
|
title varchar(128), |
||||
|
show_header boolean not null, |
||||
|
publish boolean default false not null, |
||||
|
mid varchar(32) not null, |
||||
|
publish_time timestamp with time zone, |
||||
|
constraint mirror_pk |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
comment on column mirror.template is '模板标识'; |
||||
|
|
||||
|
create unique index if not exists mirror_id_uindex |
||||
|
on mirror (id); |
||||
|
|
||||
|
create table if not exists mirror_tree |
||||
|
( |
||||
|
id serial not null, |
||||
|
name varchar(64) not null, |
||||
|
level integer not null, |
||||
|
dependence integer, |
||||
|
mirror_id integer not null, |
||||
|
constraint mirror_tree_pk |
||||
|
primary key (id), |
||||
|
constraint mirror_tree_mirror_id_fk |
||||
|
foreign key (mirror_id) references mirror |
||||
|
); |
||||
|
|
||||
|
comment on table mirror_tree is '镜像服务的树节点'; |
||||
|
|
||||
|
comment on column mirror_tree.level is '层级标注'; |
||||
|
|
||||
|
create unique index if not exists mirror_tree_id_uindex |
||||
|
on mirror_tree (id); |
||||
|
|
||||
|
create table if not exists mirror_filter_group |
||||
|
( |
||||
|
id serial not null, |
||||
|
name varchar(64) not null, |
||||
|
forbidden boolean default false not null, |
||||
|
mirror_id integer not null, |
||||
|
constraint mirror_filter_group_pk |
||||
|
primary key (id), |
||||
|
constraint mirror_filter_group_mirror_id_fk |
||||
|
foreign key (mirror_id) references mirror |
||||
|
); |
||||
|
|
||||
|
comment on table mirror_filter_group is '筛选分组'; |
||||
|
|
||||
|
create unique index if not exists mirror_filter_group_id_uindex |
||||
|
on mirror_filter_group (id); |
||||
|
|
||||
|
create table if not exists mirror_filter |
||||
|
( |
||||
|
id serial not null, |
||||
|
name varchar(64) not null, |
||||
|
group_id integer not null, |
||||
|
constraint mirror_filter_pk |
||||
|
primary key (id), |
||||
|
constraint mirror_filter_mirror_filter_group_id_fk |
||||
|
foreign key (group_id) references mirror_filter_group |
||||
|
); |
||||
|
|
||||
|
create unique index if not exists mirror_filter_id_uindex |
||||
|
on mirror_filter (id); |
||||
|
|
||||
|
create table if not exists mirror_camera |
||||
|
( |
||||
|
id serial not null, |
||||
|
camera_id integer not null, |
||||
|
tree_ids integer[] not null, |
||||
|
filter_ids integer[], |
||||
|
mirror_id integer not null, |
||||
|
constraint mirror_camera_pk |
||||
|
primary key (id), |
||||
|
constraint mirror_camera_camera_id_fk |
||||
|
foreign key (camera_id) references camera, |
||||
|
constraint mirror_camera_mirror_id_fk |
||||
|
foreign key (mirror_id) references mirror |
||||
|
); |
||||
|
|
||||
|
create unique index if not exists mirror_camera_id_uindex |
||||
|
on mirror_camera (id); |
||||
|
|
Loading…
Reference in new issue