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;