Refine control schema
This commit is contained in:
@@ -1,30 +1,6 @@
|
|||||||
-- [CONTROLS]
|
-- [CONTROLS]
|
||||||
|
|
||||||
create type controls_1_prep as enum ('above', 'below');
|
create table controls
|
||||||
|
|
||||||
-- LINK linkID status IF NODE nodeID ABOVE / BELOW value
|
|
||||||
create table controls_1
|
|
||||||
(
|
(
|
||||||
linkid varchar(32) primary key references _link(id)
|
control text primary key
|
||||||
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
||||||
, nodeid varchar(32) references _node(id) not null
|
|
||||||
, prep controls_1_prep not null
|
|
||||||
, value numeric not null
|
|
||||||
);
|
|
||||||
|
|
||||||
-- LINK linkID status AT TIME time
|
|
||||||
create table controls_2
|
|
||||||
(
|
|
||||||
linkid varchar(32) primary key references _link(id)
|
|
||||||
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
||||||
, time interval hour
|
|
||||||
);
|
|
||||||
|
|
||||||
-- LINK linkID status AT CLOCKTIME clocktime AM / PM
|
|
||||||
create table controls_3
|
|
||||||
(
|
|
||||||
linkid varchar(32) primary key references _link(id)
|
|
||||||
, status text not null -- open / closed, a pump speed setting, or a control valve setting
|
|
||||||
, clock_time_hour interval hour -- get am/pm from it
|
|
||||||
, clock_time_min interval minute
|
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
-- [CONTROLS]
|
-- [CONTROLS]
|
||||||
|
|
||||||
drop table if exists controls_3;
|
drop table if exists controls;
|
||||||
|
|
||||||
drop table if exists controls_2;
|
|
||||||
|
|
||||||
drop table if exists controls_1;
|
|
||||||
|
|
||||||
drop type if exists controls_1_prep;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user