From 26e5c112a204b9e90114fa547b852434aee13220 Mon Sep 17 00:00:00 2001
From: alex <alex@pdp7.net>
Date: Sun, 22 Oct 2023 11:07:34 +0200
Subject: Add measurement kinds

---
 sql/weight.sql | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'sql/weight.sql')

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"}');
-- 
cgit v1.2.3

