Refine control schema

This commit is contained in:
WQY\qiong
2022-10-22 10:58:08 +08:00
parent 508822c91c
commit 9fabfbbbd3
2 changed files with 3 additions and 33 deletions

View File

@@ -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
);

View File

@@ -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;