pysql/init.sql

11 lines
1.1 KiB
SQL

create database rasolar;
create user 'rasolar'@'localhost' identified by 'rasolar';
grant all privileges on rasolar.* to 'rasolar'@'localhost';
create table if not exists rasolar.measures (time bigint unsigned not null, id int unsigned not null, value int unsigned not null, index(time,id));
create table if not exists rasolar.ids (id bigint primary key,device varchar(32),varname varchar(32),sensor varchar(32),i2c int unsigned,sensorsub varchar(32));
create table if not exists rasolar.clients (ip varchar(16) not null unique,keyid varchar(24) not null,fingerprint varchar(46) not null);
create table if not exists rasolar.hourly_measures (time bigint unsigned not null, id int unsigned not null, value int unsigned not null, index(time,id));
create table if not exists rasolar.daily_measures (time bigint unsigned not null, id int unsigned not null, value int unsigned not null, index(time,id));
create table if not exists rasolar.last_measures (time bigint unsigned not null, id int unsigned not null, value int unsigned not null, index(time,id));
create table if not exists rasolar.short_names (id bigint not null, short varchar(16));