57 lines
1.8 KiB
SQL
57 lines
1.8 KiB
SQL
CREATE DATABASE poconsole;
|
||
USE poconsole;
|
||
CREATE TABLE IF NOT EXISTS tag_classes(
|
||
id int(11) NOT NULL AUTO_INCREMENT,
|
||
tag_class varchar(64),
|
||
description varchar(64),
|
||
PRIMARY KEY (id)
|
||
);
|
||
|
||
CREATE TABLE IF NOT EXISTS tags(
|
||
id int(11) NOT NULL AUTO_INCREMENT,
|
||
name varchar(128),
|
||
class int(11),
|
||
tag varchar(128),
|
||
description varchar(128),
|
||
data_type varchar(32),
|
||
change_threshold float,
|
||
guarantee_sec integer(11),
|
||
map_function varchar(64),
|
||
units varchar(64),
|
||
minExpected varchar(64),
|
||
maxExpected varchar(64),
|
||
deleted INT NULL DEFAULT 0,
|
||
PRIMARY KEY (id)
|
||
);
|
||
|
||
|
||
CREATE TABLE IF NOT EXISTS tag_vals(
|
||
id int(11) NOT NULL AUTO_INCREMENT,
|
||
dtime datetime,
|
||
tagID int,
|
||
val float,
|
||
PRIMARY KEY (id)
|
||
);
|
||
|
||
CREATE TABLE IF NOT EXISTS config (
|
||
id INT NOT NULL AUTO_INCREMENT,
|
||
parameter varchar(128),
|
||
val varchar(128),
|
||
dateAdded TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
|
||
PRIMARY KEY (id)
|
||
);
|
||
|
||
INSERT INTO poconsole.tag_classes (id, tag_class, description) VALUES (1, 'stroke', 'Stroke Information');
|
||
INSERT INTO poconsole.tag_classes (id, tag_class, description) VALUES (2, 'history', 'Historical Data');
|
||
INSERT INTO poconsole.tag_classes (id, tag_class, description) VALUES (3, 'gaugeoff', 'Gauge Off Data');
|
||
INSERT INTO poconsole.tag_classes (id, tag_class, description) VALUES (4, 'welltest', 'Well Test Data');
|
||
INSERT INTO poconsole.tag_classes (id, tag_class, description) VALUES (5, 'custom', 'Custom tags');
|
||
|
||
CREATE USER 'website'@'localhost' IDENTIFIED BY 'henrypump';
|
||
GRANT ALL ON *.* TO 'website'@'localhost';
|
||
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'henrypump';
|
||
GRANT ALL ON *.* to 'admin'@'localhost';
|
||
CREATE USER 'admin'@'%' IDENTIFIED BY 'henrypump';
|
||
GRANT ALL ON *.* to 'admin'@'%';
|
||
FLUSH PRIVILEGES;
|