]> xn--ix-yja.es Git - alex.git/commitdiff
Add measurement kinds
authoralex <alex@pdp7.net>
Sun, 22 Oct 2023 09:07:34 +0000 (11:07 +0200)
committeralex <alex@pdp7.net>
Sun, 22 Oct 2023 09:07:34 +0000 (11:07 +0200)
sql/weight.sql

index 8881bfd724140e4cf265d06c6e5be458dd44d41d..e97bf05738036d9caf13a497e94cae8f30f1fc43 100644 (file)
@@ -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"}');