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.
141 lines
4.3 KiB
141 lines
4.3 KiB
2 years ago
|
create table if not exists camera_status
|
||
|
(
|
||
|
id serial not null,
|
||
|
platform varchar(32) not null,
|
||
|
status varchar(32) not null,
|
||
|
describe varchar(1024),
|
||
|
paraphrase varchar(1024),
|
||
|
forbidden boolean default false not null,
|
||
|
paraphrase_custom varchar(1024),
|
||
|
constraint camera_status_pk
|
||
|
primary key (id)
|
||
|
);
|
||
|
|
||
|
comment on column camera_status.platform is '平台分类 yingshi gb';
|
||
|
|
||
|
comment on column camera_status.describe is '错误描述';
|
||
|
|
||
|
comment on column camera_status.paraphrase is '释义';
|
||
|
|
||
|
comment on column camera_status.forbidden is '是否禁用';
|
||
|
|
||
|
comment on column camera_status.paraphrase_custom is '自定义释义';
|
||
|
|
||
|
create unique index if not exists camera_status_id_uindex
|
||
|
on camera_status (id);
|
||
|
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_log
|
||
|
(
|
||
|
id serial not null,
|
||
|
status_id integer not null,
|
||
|
time timestamp not null,
|
||
|
constraint camera_status_log_pk
|
||
|
primary key (id),
|
||
|
constraint camera_status_log_camera_status_id_fk
|
||
|
foreign key (status_id) references camera_status
|
||
|
);
|
||
|
|
||
|
create unique index if not exists camera_status_log_id_uindex
|
||
|
on camera_status_log (id);
|
||
|
|
||
|
create unique index if not exists camera_status_log_id_uindex_2
|
||
|
on camera_status_log (id);
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_push_config
|
||
|
(
|
||
|
id serial not null,
|
||
|
name varchar(64) not null,
|
||
|
push_way varchar(32) not null,
|
||
|
notice_way varchar(32) not null,
|
||
|
create_user integer not null,
|
||
|
forbidden boolean default false not null,
|
||
|
timing varchar(32),
|
||
|
constraint camera_online_status_push_config_pk
|
||
|
primary key (id)
|
||
|
);
|
||
|
|
||
|
comment on column camera_status_push_config.push_way is '推送方式 email / phone';
|
||
|
|
||
|
comment on column camera_status_push_config.notice_way is '通知方式 offline / online / timing';
|
||
|
|
||
|
comment on column camera_status_push_config.timing is '定时推送时间';
|
||
|
|
||
|
create unique index if not exists camera_online_status_push_config_id_uindex
|
||
|
on camera_status_push_config (id);
|
||
|
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_push_log
|
||
|
(
|
||
|
id serial not null,
|
||
|
push_config_id integer,
|
||
|
receiver jsonb not null,
|
||
|
time timestamp,
|
||
|
push_way varchar(128) not null,
|
||
|
constraint camera_status_push_log_pk
|
||
|
primary key (id)
|
||
|
);
|
||
|
|
||
|
comment on table camera_status_push_log is '上下线推送日志';
|
||
|
|
||
|
create unique index if not exists camera_status_push_log_id_uindex
|
||
|
on camera_status_push_log (id);
|
||
|
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_push_monitor
|
||
|
(
|
||
|
id serial not null,
|
||
|
config_id integer not null,
|
||
|
camera_id integer not null,
|
||
|
constraint camera_status_push_monitor_pk
|
||
|
primary key (id),
|
||
|
constraint camera_status_push_monitor_camera_id_fk
|
||
|
foreign key (camera_id) references camera,
|
||
|
constraint camera_status_push_monitor_camera_status_push_config_id_fk
|
||
|
foreign key (config_id) references camera_status_push_config
|
||
|
);
|
||
|
|
||
|
create unique index if not exists camera_status_push_monitor_id_uindex
|
||
|
on camera_status_push_monitor (id);
|
||
|
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_push_receiver
|
||
|
(
|
||
|
id serial not null,
|
||
|
config_id integer not null,
|
||
|
receiver varchar(64) not null,
|
||
|
constraint camera_status_push_receiver_pk
|
||
|
primary key (id),
|
||
|
constraint camera_status_push_receiver_camera_status_push_config_id_fk
|
||
|
foreign key (config_id) references camera_status_push_config
|
||
|
);
|
||
|
|
||
|
comment on column camera_status_push_receiver.receiver is '接受者信息 邮箱或者电话号码';
|
||
|
|
||
|
create unique index if not exists camera_status_push_receiver_id_uindex
|
||
|
on camera_status_push_receiver (id);
|
||
|
|
||
|
|
||
|
create table if not exists camera_status_resolve
|
||
|
(
|
||
|
id serial not null,
|
||
|
status_id integer not null,
|
||
|
resolve varchar(1024) not null,
|
||
|
constraint camera_status_resolve_pk
|
||
|
primary key (id),
|
||
|
constraint camera_status_resolve_camera_status_id_fk
|
||
|
foreign key (status_id) references camera_status
|
||
|
);
|
||
|
|
||
|
comment on table camera_status_resolve is '错误码解决方案';
|
||
|
|
||
|
create unique index if not exists camera_status_resolve_id_uindex
|
||
|
on camera_status_resolve (id);
|
||
|
|
||
|
|