--
-- Host: 166.78.158.45    Database: STRONGLOOP
-- ------------------------------------------------------


--
-- Current Database: `STRONGLOOP`
--

/*!40000 DROP DATABASE IF EXISTS `STRONGLOOP`*/;

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `STRONGLOOP` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `STRONGLOOP`;

--
-- Table structure for table `CUSTOMER`
--

CREATE TABLE `CUSTOMER` (
  `ID` varchar(20) NOT NULL,
  `NAME` varchar(40) DEFAULT NULL,
  `MILITARY_AGENCY` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `CUSTOMER`
--


--
-- Table structure for table `INVENTORY`
--

CREATE TABLE `INVENTORY` (
  `PRODUCT_ID` varchar(20) NOT NULL,
  `LOCATION_ID` varchar(20) NOT NULL,
  `AVAILABLE` int(11) DEFAULT NULL,
  `TOTAL` int(11) DEFAULT NULL,
  `ACTIVE` BOOLEAN DEFAULT TRUE,
  `DISABLED` BIT(1) DEFAULT 0,
  `ENABLED` CHAR(1) DEFAULT 'Y',
  PRIMARY KEY (`PRODUCT_ID`,`LOCATION_ID`),
  KEY `LOCATION_FK` (`LOCATION_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `INVENTORY`
--


--
-- Temporary view structure for view `INVENTORY_VIEW`
--

/*!50001 DROP VIEW IF EXISTS `INVENTORY_VIEW`*/;
/*!50001 CREATE VIEW `INVENTORY_VIEW` AS SELECT
 1 AS `ID`,
 1 AS `PRODUCT_ID`,
 1 AS `PRODUCT_NAME`,
 1 AS `AUDIBLE_RANGE`,
 1 AS `EFFECTIVE_RANGE`,
 1 AS `ROUNDS`,
 1 AS `EXTRAS`,
 1 AS `FIRE_MODES`,
 1 AS `LOCATION_ID`,
 1 AS `LOCATION`,
 1 AS `CITY`,
 1 AS `ZIPCODE`,
 1 AS `AVAILABLE`*/;

--
-- Table structure for table `LOCATION`
--

CREATE TABLE `LOCATION` (
  `ID` varchar(20) NOT NULL,
  `STREET` varchar(20) DEFAULT NULL,
  `CITY` varchar(20) DEFAULT NULL,
  `ZIPCODE` varchar(20) DEFAULT NULL,
  `NAME` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `LOCATION`
--


--
-- Table structure for table `PRODUCT`
--

CREATE TABLE `PRODUCT` (
  `ID` varchar(20) NOT NULL,
  `NAME` varchar(64) DEFAULT NULL,
  `AUDIBLE_RANGE` decimal(12,2) DEFAULT NULL,
  `EFFECTIVE_RANGE` decimal(12,2) DEFAULT NULL,
  `ROUNDS` decimal(10,0) DEFAULT NULL,
  `EXTRAS` varchar(64) DEFAULT NULL,
  `FIRE_MODES` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `PRODUCT`
--


--
-- Table structure for table `RESERVATION`
--

CREATE TABLE `RESERVATION` (
  `ID` varchar(20) NOT NULL,
  `PRODUCT_ID` varchar(20) NOT NULL,
  `LOCATION_ID` varchar(20) NOT NULL,
  `CUSTOMER_ID` varchar(20) NOT NULL,
  `QTY` int(11) DEFAULT NULL,
  `STATUS` varchar(20) DEFAULT NULL,
  `RESERVE_DATE` date DEFAULT NULL,
  `PICKUP_DATE` date DEFAULT NULL,
  `RETURN_DATE` date DEFAULT NULL,
  PRIMARY KEY (`ID`),
  KEY `RESERVATION_PRODUCT_FK` (`PRODUCT_ID`),
  KEY `RESERVATION_LOCATION_FK` (`LOCATION_ID`),
  KEY `RESERVATION_CUSTOMER_FK` (`CUSTOMER_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `RESERVATION`
--


--
-- Table structure for table `TESTGEN`
--

CREATE TABLE `TESTGEN` (
  `ID` int(11) NOT NULL  AUTO_INCREMENT,
  `NAME` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Current Database: `STRONGLOOP`
--

USE `STRONGLOOP`;

--
-- Final view structure for view `INVENTORY_VIEW`
--

/*!50001 DROP VIEW IF EXISTS `INVENTORY_VIEW`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`strongloop`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `INVENTORY_VIEW` AS select concat(concat(`P`.`ID`,':'),`L`.`ID`) AS `ID`,`P`.`ID` AS `PRODUCT_ID`,`P`.`NAME` AS `PRODUCT_NAME`,`P`.`AUDIBLE_RANGE` AS `AUDIBLE_RANGE`,`P`.`EFFECTIVE_RANGE` AS `EFFECTIVE_RANGE`,`P`.`ROUNDS` AS `ROUNDS`,`P`.`EXTRAS` AS `EXTRAS`,`P`.`FIRE_MODES` AS `FIRE_MODES`,`L`.`ID` AS `LOCATION_ID`,`L`.`NAME` AS `LOCATION`,`L`.`CITY` AS `CITY`,`L`.`ZIPCODE` AS `ZIPCODE`,`I`.`AVAILABLE` AS `AVAILABLE` from ((`INVENTORY` `I` join `PRODUCT` `P`) join `LOCATION` `L`) where ((`P`.`ID` = `I`.`PRODUCT_ID`) and (`L`.`ID` = `I`.`LOCATION_ID`)) */;


