Refine status schema
This commit is contained in:
@@ -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)
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user