-- [CONTROLS] create type controls_1_prep as enum ('above', 'below'); -- LINK linkID status IF NODE nodeID ABOVE / BELOW value create table controls_1 ( linkid varchar(32) primary key references _link(id) , 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 );