ci added
This commit is contained in:
31
schema/create-schema.sql
Normal file
31
schema/create-schema.sql
Normal file
@ -0,0 +1,31 @@
|
||||
create database level_monitoring;
|
||||
create extension timescaledb;
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
create user preprocessor password 'geheim';
|
||||
grant select on application_t to preprocessor;
|
||||
grant insert on measurement_t to preprocessor;
|
||||
|
@ -1,30 +0,0 @@
|
||||
-- extend the schema monitoring from badesee application
|
||||
|
||||
|
||||
create table level_sensor_t (
|
||||
id serial not null primary key,
|
||||
sensor_type varchar(16) not null,
|
||||
ground_level numeric(10, 0) not null,
|
||||
device integer not null references device_id(id),
|
||||
unique(device)
|
||||
);
|
||||
|
||||
create table level_measurement_t (
|
||||
time timestamp without time zone not null,
|
||||
device_name varchar(16) not null,
|
||||
raw_level numeric(10, 0),
|
||||
level numeric(10, 0),
|
||||
status varchar(16),
|
||||
battery float
|
||||
);
|
||||
|
||||
select create_hypertable('level_measurement_t', 'time');
|
||||
|
||||
insert into device_t (device_id, label) values('eui-a84041a2c18341d6', 'deilbach');
|
||||
insert into level_sensor_t (sensor_type, ground_level, device)
|
||||
values('LDDS75', 300, (select id from device_t where device_id='eui-a84041a2c18341d6'));
|
||||
|
||||
create user level_preprocessor password 'geheim';
|
||||
grant select on device_t, level_sensor_t to level_preprocessor;
|
||||
grant insert on level_measurement_t to level_preprocessor;
|
||||
|
Reference in New Issue
Block a user