reading tags from mysql and writing values to mysql

This commit is contained in:
Patrick McDonagh
2016-04-07 17:06:55 -05:00
parent f0f94aaa0f
commit 528b62bcbb
12 changed files with 64 additions and 28 deletions

View File

@@ -1,18 +1,46 @@
CREATE DATABASE TagData;
CREATE TABLE `TagData`.`tags` (
`id` INT NOT NULL AUTO_INCREMENT,
`tagName` VARCHAR(128) NULL,
`dateAdded` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`units` VARCHAR(16) NULL,
`deleted` INT NULL DEFAULT 0,
PRIMARY KEY (`id`));
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 `TagData`.`values` (
`id` INT NOT NULL AUTO_INCREMENT,
`tagID` INT NULL,
`val` FLOAT NULL,
`dateAdded` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
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';
@@ -20,4 +48,4 @@ 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;
FLUSH PRIVILEGES;