52 lines
1.7 KiB
SQL
52 lines
1.7 KiB
SQL
CREATE DATABASE poconsole;
|
|
CREATE TABLE IF NOT EXISTS poconsole.tag_classes(
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
tag_class varchar(64),
|
|
description varchar(64),
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS poconsole.tags(
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
name TEXT,
|
|
class int(11),
|
|
tag varchar(128),
|
|
data_type varchar(32),
|
|
change_threshold float,
|
|
guarantee_sec integer(11),
|
|
map_function varchar(64),
|
|
deleted INT NULL DEFAULT 0,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS poconsole.tag_vals(
|
|
id int(11) NOT NULL AUTO_INCREMENT,
|
|
dtime datetime,
|
|
name varchar(128),
|
|
val float,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS poconsole.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;
|