summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-10-22 11:07:34 +0200
committeralex <alex@pdp7.net>2023-10-22 11:07:34 +0200
commit26e5c112a204b9e90114fa547b852434aee13220 (patch)
tree0460dff9e26e7c30140abf77868117c69edcb1a1 /sql
parent1bd6cb89f23ad56dea744f54cf469d2acafa0c24 (diff)
Add measurement kinds
Diffstat (limited to 'sql')
-rw-r--r--sql/weight.sql7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/weight.sql b/sql/weight.sql
index 8881bfd7..e97bf057 100644
--- a/sql/weight.sql
+++ b/sql/weight.sql
@@ -6,7 +6,8 @@ create table weight.weight (
create table weight.bp (
measured_at timestamp with time zone primary key default now(),
systolic numeric(3, 0) not null,
- diastolic numeric(3, 0) not null
+ diastolic numeric(3, 0) not null,
+ kind text check (kind in ('standard', 'home', 'doctor')) default 'standard' not null
);
create schema zqxjk;
@@ -18,7 +19,7 @@ create view zqxjk.weight as (
from weight.weight
);
-create view zqxjk.bp as (
+create view zqxjk.bp_standard_measure as (
select to_char(measured_at, 'YYYY-MM-DD"T"HH24:MI:SSOF') as _id,
measured_at || ' ' || systolic || '-' || diastolic as _display,
systolic,
@@ -41,4 +42,4 @@ create table zqxjk._tables (
insert into zqxjk._tables(name, default_sort) values ('weight', '{"_id", "desc"}');
insert into zqxjk._tables(name, default_sort) values ('admin_weight', '{"_id", "desc"}');
-insert into zqxjk._tables(name, default_sort) values ('bp', '{"_id", "desc"}');
+insert into zqxjk._tables(name, default_sort) values ('bp_standard_measure', '{"_id", "desc"}');