32 lines
851 B
MySQL
Raw Normal View History

2023-02-17 11:54:17 +01:00
create database level_monitoring;
2023-02-20 09:10:45 +01:00
-- create extension timescaledb;
2023-02-17 11:54:17 +01:00
create table application_t (
id serial not null primary key,
device_id VARCHAR(32) NOT NULL UNIQUE,
label varchar(16) not null unique,
sensor_type varchar(16) not null,
ground_level numeric(10, 0) not null
);
create table measurement_t (
time timestamp without time zone not null,
application_name varchar(16) not null,
raw_level numeric(10, 0),
level numeric(10, 0),
status varchar(16),
battery float
);
select create_hypertable('measurement_t', 'time');
insert into application_t (device_id, label, sensor_type, ground_level)
values('eui-a84041a2c18341d6', 'deilbach', 'LDDS75', 300);
2023-02-20 09:10:45 +01:00
-- create user preprocessor password 'geheim';
2023-02-17 11:54:17 +01:00
grant select on application_t to preprocessor;
grant insert on measurement_t to preprocessor;