-- MySQL dump 10.15  Distrib 10.0.12-MariaDB, for debian-linux-gnu (armv6l)
--
-- Host: localhost    Database: WellData
-- ------------------------------------------------------
-- Server version	10.0.12-MariaDB-1~wheezy-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `Event_List`
--
CREATE DATABASE IF NOT EXISTS WellData;
USE WellData;
DROP TABLE IF EXISTS `Event_List`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Event_List` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `device_name` varchar(45) DEFAULT NULL,
  `type` varchar(45) DEFAULT NULL,
  `cond` varchar(45) DEFAULT NULL,
  `value` float DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `tag` varchar(45) DEFAULT NULL,
  `stroke_number` int(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Event_List`
--

LOCK TABLES `Event_List` WRITE;
/*!40000 ALTER TABLE `Event_List` DISABLE KEYS */;
/*!40000 ALTER TABLE `Event_List` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Hist_Day`
--

DROP TABLE IF EXISTS `Hist_Day`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Hist_Day` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `gauge_date` datetime DEFAULT NULL,
  `percent_run` float DEFAULT NULL,
  `kWh` float DEFAULT NULL,
  `electricity_cost` float DEFAULT NULL,
  `peak_load` float DEFAULT NULL,
  `min_load` float DEFAULT NULL,
  `average_SPM` float DEFAULT NULL,
  `production_calculated` float DEFAULT NULL,
  `full_card_production` float DEFAULT NULL,
  `polished_rod_HP` float DEFAULT NULL,
  `lifting_cost` float DEFAULT NULL,
  `fluid_above_pump` float DEFAULT NULL,
  `pump_intake_pressure` float DEFAULT NULL,
  `kWh_regen` float DEFAULT NULL,
  `inflow_rate` float DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=79 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Hist_Day`
--

LOCK TABLES `Hist_Day` WRITE;
/*!40000 ALTER TABLE `Hist_Day` DISABLE KEYS */;
/*!40000 ALTER TABLE `Hist_Day` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Well_Test`
--

DROP TABLE IF EXISTS `Well_Test`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Well_Test` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `test_date` datetime DEFAULT NULL,
  `test_volume_oil` float DEFAULT NULL,
  `test_volume_water` float DEFAULT NULL,
  `test_volume_gas` float DEFAULT NULL,
  `k_factor` float DEFAULT NULL,
  `projected_volume_oil` float DEFAULT NULL,
  `projected_volume_water` float DEFAULT NULL,
  `api_gravity_oil` float DEFAULT NULL,
  `sg_oil` float DEFAULT NULL,
  `sg_water` float DEFAULT NULL,
  `test_hours` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Well_Test`
--

LOCK TABLES `Well_Test` WRITE;
/*!40000 ALTER TABLE `Well_Test` DISABLE KEYS */;
/*!40000 ALTER TABLE `Well_Test` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `config`
--

DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `device_type` varchar(45) DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `dateChanged` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `config`
--


DROP TABLE IF EXISTS `Notes`;

CREATE  TABLE `Notes` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `author` VARCHAR(64) NULL ,
  `note` VARCHAR(512) NULL ,
  `datetime` TIMESTAMP NULL DEFAULT NOW() ,
  `type` INT NULL ,
  `associated_stroke` INT NULL ,
  `deleted` INT NULL DEFAULT 0 ,
  PRIMARY KEY (`id`) );


-- Dump completed on 2015-02-25 20:36:45
DROP TABLE IF EXISTS `note_types`;

CREATE  TABLE `WellData`.`note_types` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `type` VARCHAR(64) NULL ,
  `deleted` INT NULL DEFAULT 0 ,
  PRIMARY KEY (`id`) );


INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('1', 'Downtime Explanation');
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('2', 'Configuration Change');
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('3', 'Info');
INSERT INTO `WellData`.`note_types` (`id`, `type`) VALUES ('4', 'Other');

DROP TABLE IF EXISTS `fluid_shot`;

CREATE TABLE `WellData`.`fluid_shot` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `shot_datetime` DATETIME NULL,
  `pump_intake_pressure` FLOAT NULL,
  `fluid_gradient` FLOAT NULL,
  `friction` FLOAT NULL,
  PRIMARY KEY (`id`));


  CREATE TABLE `card_history` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Stroke_Time` datetime DEFAULT NULL,
  `Card_ID` int(11) NOT NULL,
  `Num_Tapers` int(11) DEFAULT NULL,
  `Num_Points` int(11) DEFAULT NULL,
  `Card_Type` varchar(45) DEFAULT NULL,
  `Tubing_Head_Pressure` float DEFAULT NULL,
  `Fluid_Gradient` float DEFAULT NULL,
  `Stuffing_Box_Friction` float DEFAULT NULL,
  `dt` float DEFAULT NULL,
  `Downhole_Max_Load` float DEFAULT NULL,
  `Downhole_Min_Load` float DEFAULT NULL,
  `Downhole_Max_Position` float DEFAULT NULL,
  `Downhole_Min_Position` float DEFAULT NULL,
  `Downhole_Gross_Stroke` float DEFAULT NULL,
  `Downhole_Adjusted_Gross_Stroke` float DEFAULT NULL,
  `Downhole_Net_Stroke` float DEFAULT NULL,
  `Downhole_Fluid_Load` float DEFAULT NULL,
  `Surface_Max_Load` float DEFAULT NULL,
  `Surface_Min_Load` float DEFAULT NULL,
  `Surface_Max_Position` float DEFAULT NULL,
  `Surface_Min_Position` float DEFAULT NULL,
  `Tubing_Movement` float DEFAULT NULL,
  `Surface_Stroke_Length` float DEFAULT NULL,
  `Fillage_Percent` float DEFAULT NULL,
  `Polished_Rod_HP` float DEFAULT NULL,
  `Pump_HP` float DEFAULT NULL,
  `SPM` float DEFAULT NULL,
  `Fluid_Level` float DEFAULT NULL,
  `Pump_Intake_Pressure` float DEFAULT NULL,
  `Stroke_Production` float DEFAULT NULL,
  `Drive_Torque_Mode` int(11) DEFAULT NULL,
  `Drive_Reference` float DEFAULT NULL,
  `Surface_Position` blob,
  `Surface_Load` blob,
  `Downhole_Position` blob,
  `Downhole_Load` blob,
  PRIMARY KEY (`id`,`Card_ID`)
);

CREATE  TABLE `WellData`.`card_history_dates` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `year` INT NULL ,
  `month` INT NULL ,
  `day` INT NULL ,
  `first_id` INT NULL ,
  PRIMARY KEY (`id`) );
