Implementation of /measure, /measurements APIs.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
-- DOWN script for initial-schema (20190214122514)
|
||||
drop table if exists "values";
|
||||
drop table if exists "measurements";
|
||||
drop table if exists "measures";
|
||||
drop table if exists "api_tokens";
|
||||
drop table if exists "users";
|
||||
|
@ -6,7 +6,8 @@ create table "users" (
|
||||
display_name varchar not null,
|
||||
email varchar not null unique,
|
||||
hashed_pwd varchar not null,
|
||||
salt varchar not null
|
||||
salt varchar not null,
|
||||
is_admin boolean not null default false
|
||||
);
|
||||
|
||||
create table "api_tokens" (
|
||||
@ -27,13 +28,14 @@ create table "measures" (
|
||||
domain_units varchar not null default '',
|
||||
range_source varchar default null,
|
||||
range_units varchar not null default '',
|
||||
analysis varchar[] not null default '{}'
|
||||
analysis varchar[] not null default '{}',
|
||||
unique(user_id, slug)
|
||||
);
|
||||
|
||||
create table "values" (
|
||||
create table "measurements" (
|
||||
id uuid default uuid_generate_v4() primary key,
|
||||
measure_id uuid not null references measures (id) on delete cascade on update cascade,
|
||||
value integer not null,
|
||||
"timestamp" timestamp not null default current_timestamp,
|
||||
"timestamp" timestamp with time zone not null default current_timestamp,
|
||||
ext_data jsonb not null default '{}'::json
|
||||
);
|
||||
|
Reference in New Issue
Block a user