MySQL Setup successful
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
CREATE DATABASE IF NOT EXISTS poconsole;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.Event_List (
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
device_name varchar(64),
|
||||
type varchar(64),
|
||||
cond varchar(64),
|
||||
@@ -13,7 +13,7 @@ CREATE TABLE IF NOT EXISTS poconsole.Event_List (
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.Hist_Day (
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
gauge_date datetime,
|
||||
percent_run float,
|
||||
kWh float,
|
||||
@@ -28,11 +28,12 @@ CREATE TABLE IF NOT EXISTS poconsole.Hist_Day (
|
||||
lifting_cost float,
|
||||
fluid_above_pump float,
|
||||
pump_intake_pressure float,
|
||||
inflow_rate float
|
||||
inflow_rate float,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.Well_Test (
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
test_date datetime,
|
||||
test_volume_oil float,
|
||||
test_volume_water float,
|
||||
@@ -49,7 +50,7 @@ CREATE TABLE IF NOT EXISTS poconsole.Well_Test (
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.config (
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
device_type varchar(64),
|
||||
ip_address varchar(64),
|
||||
dateChanged datetime DEFAULT NOW(),
|
||||
@@ -57,7 +58,7 @@ CREATE TABLE IF NOT EXISTS poconsole.config (
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.Notes (
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
author varchar(64),
|
||||
note varchar(64),
|
||||
datetime datetime DEFAULT NOW(),
|
||||
@@ -68,7 +69,7 @@ CREATE TABLE IF NOT EXISTS poconsole.Notes (
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.note_types(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
type varchar(64),
|
||||
deleted int(11) DEFAULT 0,
|
||||
PRIMARY KEY (id)
|
||||
@@ -82,7 +83,7 @@ INSERT INTO poconsole.note_types (id, type) VALUES ('4', 'Other');
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.fluid_shot(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
shot_datetime datetime,
|
||||
taken_by varchar(64),
|
||||
pump_intake_pressure float,
|
||||
@@ -93,9 +94,9 @@ CREATE TABLE IF NOT EXISTS poconsole.fluid_shot(
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.card_history(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
Stroke_Time datetime,
|
||||
Card_ID int(11),
|
||||
Card_id int(11),
|
||||
Card_Type varchar(64),
|
||||
Surface_Position varchar(4000),
|
||||
Surface_Load varchar(4000),
|
||||
@@ -105,7 +106,7 @@ CREATE TABLE IF NOT EXISTS poconsole.card_history(
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.card_history_dates(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
year int(11),
|
||||
month int(11),
|
||||
day int(11),
|
||||
@@ -113,16 +114,36 @@ CREATE TABLE IF NOT EXISTS poconsole.card_history_dates(
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
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),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.tag_vals(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
dtime datetime,
|
||||
name varchar(64),
|
||||
val varchar(64),
|
||||
name varchar(128),
|
||||
val float,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.well_config(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
tstamp datetime,
|
||||
type varchar(64),
|
||||
val varchar(64),
|
||||
@@ -130,12 +151,28 @@ CREATE TABLE IF NOT EXISTS poconsole.well_config(
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.run_status(
|
||||
id int(11),
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
dtime datetime,
|
||||
status varchar(64),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.alarm_classes(
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
alarm_class varchar(64),
|
||||
description varchar(128),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS poconsole.alarms(
|
||||
id int(11) NOT NULL AUTO_INCREMENT,
|
||||
name varchar(64),
|
||||
class int(11),
|
||||
tag varchar(128),
|
||||
cond varchar(64),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE USER 'website'@'localhost' IDENTIFIED BY 'henrypump';
|
||||
GRANT ALL ON *.* TO 'website'@'localhost';
|
||||
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'henrypump';
|
||||
|
||||
@@ -152,5 +152,5 @@ CREATE TABLE IF NOT EXISTS alarms(
|
||||
name TEXT,
|
||||
class INTEGER,
|
||||
tag TEXT,
|
||||
condition TEXT
|
||||
cond TEXT
|
||||
);
|
||||
|
||||
22
tagSetup.sql
22
tagSetup.sql
@@ -87,14 +87,14 @@ INSERT INTO alarms (name, class, tag) VALUES ('Speed', 1, 'Safety_Speed');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Load LoLo', 1, 'Safety_Load_LoLo');
|
||||
INSERT INTO alarms (name, class, tag) VALUES ('Inclinometer', 1, 'Safety_Inclinometer');
|
||||
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Unit Jogged', 2, 'Pump.Jog', 'Unit Jog');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (Auto Mode)', 2, 'Pump.Auto_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (POC Mode)', 2, 'Pump.POC_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (Timer Mode)', 2, 'Pump.Timed_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Restart (POC Mode)', 2, 'Pump.POC_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (Auto Mode)', 2, 'Pump.Auto_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Peak Energy Restart', 2, 'PeakEnergy.Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Peak Energy Stop', 2, 'PeakEnergy.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('User Initiated Start', 2, 'Pump.Start', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('User Initiated Stop', 2, 'Pump.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, condition) VALUES ('Pump Off (Timer Mode)', 2, 'Pump.Timed_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Unit Jogged', 2, 'Pump.Jog', 'Unit Jog');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Restart (Auto Mode)', 2, 'Pump.Auto_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Pump Off (POC Mode)', 2, 'Pump.POC_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Restart (Timer Mode)', 2, 'Pump.Timed_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Restart (POC Mode)', 2, 'Pump.POC_Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Pump Off (Auto Mode)', 2, 'Pump.Auto_Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Peak Energy Restart', 2, 'PeakEnergy.Restart', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Peak Energy Stop', 2, 'PeakEnergy.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('User Initiated Start', 2, 'Pump.Start', 'Unit Start');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('User Initiated Stop', 2, 'Pump.Stop', 'Unit Stop');
|
||||
INSERT INTO alarms (name, class, tag, cond) VALUES ('Pump Off (Timer Mode)', 2, 'Pump.Timed_Stop', 'Unit Stop');
|
||||
|
||||
Reference in New Issue
Block a user