This commit is contained in:
2023-06-02 19:57:39 +02:00
commit de1d5be201
7 changed files with 353 additions and 0 deletions

31
schema/create-schema.sql Normal file
View File

@ -0,0 +1,31 @@
create database soil_monitoring;
-- create extension timescaledb;
create table application_t (
id serial not null primary key,
device_id VARCHAR(32) NOT NULL UNIQUE,
label varchar(64) not null unique,
sensor_type varchar(16) not null
);
create table measurement_t (
time timestamp without time zone not null,
application_name varchar(64) not null,
moisture float,
temperature float,
conductivity float,
status varchar(16),
battery float
);
select create_hypertable('measurement_t', 'time');
insert into application_t (device_id, label, sensor_type)
values('eui-a840412ee18341d5', 'saerbeck-bachaue', 'LSE01');
-- create user preprocessor password 'geheim';
grant select on application_t to preprocessor;
grant insert on measurement_t to preprocessor;