Refine control schema
This commit is contained in:
@@ -1,30 +1,6 @@
|
||||
-- [CONTROLS]
|
||||
|
||||
create type controls_1_prep as enum ('above', 'below');
|
||||
|
||||
-- LINK linkID status IF NODE nodeID ABOVE / BELOW value
|
||||
create table controls_1
|
||||
create table controls
|
||||
(
|
||||
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
|
||||
control text primary key
|
||||
);
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
-- [CONTROLS]
|
||||
|
||||
drop table if exists controls_3;
|
||||
|
||||
drop table if exists controls_2;
|
||||
|
||||
drop table if exists controls_1;
|
||||
|
||||
drop type if exists controls_1_prep;
|
||||
drop table if exists controls;
|
||||
|
||||
Reference in New Issue
Block a user