Refine status schema

This commit is contained in:
WQY\qiong
2022-10-22 10:57:35 +08:00
parent 2341d7f675
commit 508822c91c
2 changed files with 7 additions and 33 deletions

View File

@@ -1,29 +1,11 @@
-- [STATUS]
create type status_pipe_pump_status as enum ('open', 'closed');
create type link_status as enum ('OPEN', 'CLOSED', 'ACTIVE');
create table status_pipe
(
id varchar(32) primary key references pipes(id)
, status status_pipe_pump_status not null
);
create table status_pump
(
id varchar(32) primary key references pumps(id)
, status status_pipe_pump_status not null
);
create type status_valve_status as enum ('open', 'closed', 'active');
create table status_valve
(
id varchar(32) primary key references valves(id)
, status status_valve_status not null
);
create table status_link
create table status
(
id varchar(32) primary key references _link(id)
, setting numeric not null
, l_status link_status
, setting numeric
, check (l_status is not null or setting is not null)
);

View File

@@ -1,13 +1,5 @@
-- [STATUS]
drop table if exists status_link;
drop table if exists status;
drop table if exists status_valve;
drop type if exists status_valve_status;
drop table if exists status_pump;
drop table if exists status_pipe;
drop type if exists status_pipe_pump_status;
drop type if exists link_status;